[Gdal-dev] How to flat multiple bands image into single band image?

Frank Warmerdam warmerdam at pobox.com
Tue Mar 6 11:41:49 EST 2007

Huajun Zhang wrote:
> Hi folks,
> I want to flat a multiple band image with geotiff format into a single 
> band image, do you have any idea how to do it with GDAL or other FWTools?


What sort of merging do you want to do?  Do you want to average all the bands?
Or perhaps you just want to extract a single band?  You can extract single
bands with something like:

  gdal_translate -b 1 in.tif out.tif

But there is no ready mechanism to average bands into one result band.  The
easiest way to do this would be to write a python script using numeric to
do the averaging.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

More information about the Gdal-dev mailing list