<jupyter_start><jupyter_text>[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://githubtocolab.com/giswqs/gee-tutorials/blob/master/ImageCollection/reducing_image_collection.ipynb) **Reducing an ImageCollection**To composite images in an `ImageCollection`, use `imageCollection.reduce()`. This will composite all the images in the collection to a single image representing, for example, the min, max, mean or standard deviation of the images. (See the Reducers section for more information about reducers). For example, to create a median value image from a collection:  Create an interactive map<jupyter_code>import ee
import geemap
Map = geemap.Map()
Map<jupyter_output><empty_output><jupyter_text>Compute a median image<jupyter_code># Load a Landsat 8 collection for a single path-row.
collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA') \
    .filter(ee.Filter.eq('WRS_PATH', 44)) \
    .filter(ee.Filter.eq('WRS_ROW', 34)) \
    .filterDate('2014-01-01', '2015-01-01')

# Compute a median image and display.
median = collection.median()
Map.setCenter(-122.3578, 37.7726, 12)
Map.addLayer(median, {'bands': ['B4',  'B3',  'B2'], 'max': 0.3}, 'median')
collection.size().getInfo()
collection.aggregate_array("system:id").getInfo()<jupyter_output><empty_output><jupyter_text>Use median reducer At each location in the output image, in each band, the pixel value is the median of all unmasked pixels in the input imagery (the images in the collection). In the previous example, `median()` is a convenience method for the following call:<jupyter_code># Reduce the collection with a median reducer.
median = collection.reduce(ee.Reducer.median())

# Display the median image.
Map.addLayer(median,
             {'bands': ['B4_median',  'B3_median',  'B2_median'], 'max': 0.3},
             'also median')
Map<jupyter_output><empty_output><jupyter_text>Create an image composite<jupyter_code>states = ee.FeatureCollection('TIGER/2018/States')
Map.addLayer(states, {}, "US States")
ca = states.filter(ee.Filter.eq("NAME", "California"))
Map.addLayer(ca, {}, "California")
collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA') \
    .filterBounds(ca) \
    .filterDate('2020-01-01', '2021-01-01')
collection.size().getInfo()
image = collection.median().clip(ca)
Map.addLayer(image, {'bands': ['B4',  'B3',  'B2'], 'max': 0.3}, 'Landsat 2020')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1451077943615257, 'fraction_numerical': 0.035240464344941956, 'mean_word_length': 5.53929539295393, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '167618', 'license': 'MIT', 'n_tokens_mistral': 870, 'n_tokens_neox': 794, 'n_words': 206, 'path': 'docs/ImageCollection/reducing_image_collection.ipynb', 'repo_name': 'giswqs/gee-tutorials', 'size': '2412'}