[FWTools] How to merge two color Geotiff image into one color Geotiff

Frank Warmerdam warmerdam at pobox.com
Thu Feb 12 11:49:39 EST 2009

Lin Gan wrote:
> Hi,
> I am trying to merge two Geotiff into one. They are a world and US 
> Geotiff images. It looks fine on layer overlap in OpenEV tool. But when 
> I try to merge them into one using gdal_merge.py (FWTools 206 Linux), it 
> become BW and lose lot of resoluction. Would you please help me out with 
> this issue?


If the images are paletted - which appears to be the case - you need to
use the -pct switch to gdal_merge.py to create the output file with the
palette of the first input file. Note that the merge results will be
crazy if the input images do not actually use the same palette. If that
is the case you will really need to expand them to RGB before merging.
This can be accomplished with:

  gdal_translate -expand rgb paletted.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 FWTools mailing list