Select bands from each image in a collection.

Returns the image collection with selected bands.

UsageReturns, names)ImageCollection
this: imagecollectionImageCollectionThe ImageCollection instance.
selectorsListA list of names, regexes or numeric indices specifying the bands to select.
namesList, optionalA list of new names for the output bands. Must match the number of bands selected.


Code Editor (JavaScript)

// A Sentinel-2 surface reflectance image collection.
var col = ee.ImageCollection('COPERNICUS/S2_SR')
    .filterBounds(ee.Geometry.Point(-122.152, 37.336))
    .filterDate('2021-01-01', '2021-02-01');
print('All band names', col.first().bandNames());

print('Select a band by name','B11').first().bandNames());

print('Select a band by index',;

print('Select bands using a list',['B11', 'B8', 'B3']).first().bandNames());

print('Select bands by an argument series','B11', 'B8', 'B3').first().bandNames());

print('Mixing string and integer selectors is valid',, 'B8', 2).first().bandNames());

print('Rename selected bands using two corresponding lists',['B11', 'B8', 'B3'], ['SWIR1', 'NIR', 'Green'])

// Use regular expressions to select bands.
print('Match "QA" followed by any two characters','QA..').first().bandNames());

print('Match "B" followed by any character, any number of times','B.*').first().bandNames());

print('Match "B" followed by any character, and any optional third character','B..?').first().bandNames());

print('Match "B" followed by a character in the range 6-8','B[6-8]').first().bandNames());

print('Match "B" followed by a character in the range 1-9 and then 1-2','B[1-9][1-2]').first().bandNames());

print('Match "B" or "QA" each followed by any character, any number of times.','B.*|QA.*').first().bandNames());