[gdal-dev] Gdal_merge

Frank Warmerdam warmerdam at pobox.com
Mon Jul 20 14:34:49 EDT 2009


Denis Rykov wrote:
> Hi!
> I need merge two images - the first image is mutiband and second image 
> is singleband.
> Can I do this operation with gdal_merge or gdal_merge works only with 
> images with same number of bands?
> What utility from gdal library I can use for separate multiband image 
> into some singleband images?

Denis,

You can use gdal_translate to extract a subset of bands from an image.

The following would copy just band 2 from in.tif into a new file, out.tif.

   gdal_translate -b 2 in.tif out.tif

The following would take the first three bands from a 4 band input file.

   gdal_translate -b 1 -b 2 -b 3 rgba.tif rgb.tif

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    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list