Selects bands from an image.

Returns an image with the selected bands.

this: imageImage

The Image instance.


One of two possibilities:

  - Any number of non-list arguments. All of these will be interpreted as band selectors. These can be band names, regexes, or numeric indices. E.g. selected ='a', 'b', 3, 'd');

  - Two lists. The first will be used as band selectors and the second as new names for the selected bands. The number of new names must match the number of selected bands. E.g. selected =['a', 4], ['newA', 'newB']);


Code Editor (JavaScript)

// A Sentinel-2 surface reflectance image.
var img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG');
print('All band names', img.bandNames());

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

print('Select a band by index',;

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

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

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

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

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

print('Match "B" followed by any single character and optional final character','B.*').bandNames());

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

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