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

Huajun Zhang huajun_zhang at usgs.gov
Tue Mar 6 11:44:30 EST 2007

Thanks, Frank.  I want to merge all bands into one band image, something 
like Photoshop's flat layers function. Of course, another solution is to 
use open source image library to do it.

Best regards,

Huajun Zhang

Frank Warmerdam <warmerdam at pobox.com> 
03/06/2007 11:41 AM

Huajun Zhang <huajun_zhang at usgs.gov>
gdal-dev at lists.maptools.org
Re: [Gdal-dev] How to flat multiple bands image into single band image?

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 


What sort of merging do you want to do?  Do you want to average all the 
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070306/30e8a034/attachment.html

More information about the Gdal-dev mailing list