I have this real Big Bandet Image with 25000 Bands. I want to Sum over the Bands, Pixelwise.

is there a Way to either :

-convert this ee.image, bandwise to an ee.ImageCollection

-Collapse all Bands of means into 1 Summed Band ?


Are you looking for something like this?

var image  = ee.Image(1).addBands(ee.Image(2)).addBands(ee.Image(3)).addBands(ee.Image(4)).addBands(ee.Image(5));

var bandNames = image.bandNames();

var toCollection = ee.ImageCollection.fromImages(bandNames.map(function(name){
  name = ee.String(name);
  // select one band an put into an image. You might need a specific cast and renaming of the bands
  return image.select(name).rename('newName').toFloat();
var summedBand = toCollection.sum();





Here is another approach:

// Make a (toy) 3 bands image
var image  = ee.Image([1,2,3]).rename(['one', 'two', 'three'])
Map.addLayer(image, null, '3 bands image')

// Sum all bands
var sum_bands = image.reduce('sum')
Map.addLayer(sum_bands, null, 'sum')

// You can compute any reduction
var mean_bands = image.reduce('mean')
Map.addLayer(mean_bands, null, 'mean')

link: https://code.earthengine.google.com/9ff53b49274f3842f353a2994905e750

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.