Announcement: On November 13, 2024, all users will need to use a Cloud project in order to access Earth Engine. After this date, continued individual access without a Cloud project will require an exception.
Gets or sets an image's mask. The output image retains the metadata and footprint of the input image. Pixels where the mask changes from zero to another value will be filled with zeros, or the values closest to zero within the range of the pixel type.
Usage
Returns
Image.mask(mask)
Image
Argument
Type
Details
this: image
Image
The input image.
mask
Image, default: null
The mask image. If specified, the input image is copied to the output but given the mask by the values of this image. If this is a single band, it is used for all bands in the input image. If not specified, returns an image created from the mask of the input image, scaled to the range [0:1] (invalid = 0, valid = 1.0).
[null,null,["Last updated 2023-10-06 UTC."],[[["`Image.mask()` retrieves or sets an image mask, preserving the original image's metadata and footprint."],["When setting a mask (deprecated), pixels with mask transitions from zero are filled with near-zero values; use `Image.updateMask` or `Image.unmask` for specific mask modifications."],["If no mask is provided, it returns an image representing the input image's mask, scaled from 0 (invalid) to 1 (valid)."],["Masks can be applied to all bands of an image or to individual bands, allowing for selective pixel masking."]]],[]]