Stay organized with collections
Save and categorize content based on your preferences.
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).
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[[["`Image.mask()` retrieves or sets an image's mask, impacting pixel values based on the mask's transitions."],["When retrieving a mask, `Image.mask()` returns a new image representing the mask, scaled to 0-1, where 0 is invalid and 1 is valid."],["When setting a mask, `Image.mask()` is deprecated in favor of `Image.updateMask` and `Image.unmask` for more controlled mask manipulation."],["The output image retains the original image's metadata and footprint."],["Masks can be applied to individual bands or to the entire image."]]],[]]