ee.Image.arrayReshape

Converts array bands of an image with equally-shaped, possibly multidimensional pixels to an image of arrays with a new shape.
UsageReturns
Image.arrayReshape(lengths, dimensions)Image
ArgumentTypeDetails
this: imageImageThe image of arrays to reshape.
lengthsImageA 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.
dimensionsIntegerThe number of dimensions shared by all output array pixels.