Announcement: All noncommercial projects registered to use Earth Engine before April 15, 2025 must verify noncommercial eligibility to maintain Earth Engine access.
Stay organized with collections
Save and categorize content based on your preferences.
Converts array bands of an image with equally-shaped, possibly multidimensional pixels to an image of arrays with a new shape.
Usage
Returns
Image.arrayReshape(lengths, dimensions)
Image
Argument
Type
Details
this: image
Image
The image of arrays to reshape.
lengths
Image
A 1-band image specifying the new lengths of each axis of the input image specified as a 1-D array per pixel. There should be 'dimensions' lengths values in each shape' array. If one of the lengths is -1, then the corresponding length for that axis will be computed such that the total size remains constant. In particular, a shape of [-1] flattens into 1-D. At most one component of shape can be -1.
dimensions
Integer
The number of dimensions shared by all output array pixels.
[[["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."],[[["`Image.arrayReshape()` transforms images with array-shaped pixels into images with a new array shape, potentially changing the dimensionality of the pixels."],["It takes the original image, desired lengths for each axis of the new shape, and the total number of dimensions as input."],["You can specify `-1` for a dimension length to have Earth Engine automatically calculate it, ensuring the total number of elements remains constant."],["This function is useful for tasks like converting between 1D, 2D, or higher-dimensional array representations of data within an image."],["Examples demonstrate reshaping a 1D array into a 2D array, using `-1` for automatic dimension calculation, and flattening a 2D array back to 1D."]]],[]]