ee.Array.byte

On an element-wise basis, casts the input value to an unsigned 8-bit integer.

UsageReturns
Array.byte()Array
ArgumentTypeDetails
this: inputArray

The input array.

Examples

JavaScript

// Clamps below at 0.
print(ee.Array([-1]).byte());  // [0]
print(ee.Array([255]).byte());  // [255]
// Clamps above at 255.
print(ee.Array([256]).byte());  // [255]

// Rounds. [0,0,1,127,255,255]
print(ee.Array([-0.1, 0.1, 0.5, 127.1, 255.1, 255.9]).byte());

// Requires an explicit PixelType if no data.
print(ee.Array([[], []], ee.PixelType.float()).byte());  // Empty [[], []]

Python

# Your example goes here!