from imagecollection to image

little helper function to get the job done

// Helper function to convert image collection into stack of image bands
function newCollectionToImage(collection){
  var stack = ee.Image(collection.iterate(function(img, prev) {
    return ee.Image(prev).addBands(img);
  }, ee.Image(1)));

  stack =, stack.bandNames().size().subtract(1)));
  return stack;

And for anyone interested in the image in the header


  1. How to do it inversely? I mean from an Image with multiple bands to a feature list with all those bands?

Leave a Reply