Image Reductions

  • image.reduce() processes an image's bands with a reducer, similar to how imageCollection.reduce() processes images in a collection.

  • It outputs a new image with band count equal to the reducer's output count, for instance, using ee.Reducer.max() results in a single-band image with the maximum value across the input bands.

  • The provided code demonstrates reducing a Landsat 8 image to a single-band image representing the maximum value across selected bands (B4, B3, B2).

To reduce an Image, use image.reduce(). Reducing an image functions in an analogous way to imageCollection.reduce(), except the bands of the image are input to the reducer rather than the images in the collection. The output is also an image with number of bands equal to number of reducer outputs. For example:

Code Editor (JavaScript)

// Load an image and select some bands of interest.
var image = ee.Image('LANDSAT/LC08/C02/T1/LC08_044034_20140318')
    .select(['B4', 'B3', 'B2']);

// Reduce the image to get a one-band maximum value image.
var maxValue = image.reduce(ee.Reducer.max());

// Display the result.
Map.centerObject(image, 10);
Map.addLayer(maxValue, {max: 13000}, 'Maximum value image');

Python setup

See the Python Environment page for information on the Python API and using geemap for interactive development.

import ee
import geemap.core as geemap

Colab (Python)

# Load an image and select some bands of interest.
image = ee.Image('LANDSAT/LC08/C02/T1/LC08_044034_20140318').select(
    ['B4', 'B3', 'B2']
)

# Reduce the image to get a one-band maximum value image.
max_value = image.reduce(ee.Reducer.max())

# Display the result.
m = geemap.Map()
m.center_object(image, 10)
m.add_layer(max_value, {'max': 13000}, 'Maximum value image')
m