Stay organized with collections
Save and categorize content based on your preferences.
Casts some or all bands of an image to the specified types.
Usage
Returns
Image.cast(bandTypes, bandOrder)
Image
Argument
Type
Details
this: image
Image
The image to cast.
bandTypes
Dictionary
A dictionary from band name to band types. Types can be PixelTypes or strings. The valid strings are: 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'byte', 'short', 'int', 'long', 'float', and 'double'. If bandTypes includes bands that are not already in the input image, they will be added to the image as transparent bands. If bandOrder isn't also specified, new bands will be appended in alphabetical order.
bandOrder
List, default: null
A list specifying the order of the bands in the result. If specified, must match the full list of bands in the result.
[[["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 2024-07-13 UTC."],[[["Casts image bands to specified data types like 'int8', 'float', etc., allowing for data type conversions within an image."],["Accepts a dictionary mapping band names to desired types, enabling selective casting for individual bands."],["Can introduce new bands with specified types, appending them to the image with optional ordering using the `bandOrder` parameter."],["Returns a new Image with the converted bands, preserving the original image unchanged."]]],[]]