Giảm kích thước hình ảnh

Để giảm Image, hãy sử dụng image.reduce(). Việc giảm hình ảnh hoạt động tương tự như imageCollection.reduce(), ngoại trừ các dải của hình ảnh được đưa vào bộ giảm thay vì hình ảnh trong bộ sưu tập. Đầu ra cũng là một hình ảnh có số dải bằng số đầu ra của bộ giảm. Ví dụ:

Trình soạn thảo mã (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');

Thiết lập Python

Hãy xem trang Môi trường Python để biết thông tin về API Python và cách sử dụng geemap để phát triển tương tác.

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