[gdal-dev] merge two black/white image -> result only black

Frank Warmerdam warmerdam at pobox.com
Wed Dec 9 12:50:15 EST 2009


Jan Tappenbeck wrote:
> hallo !
> 
> i had two tif-image and want to merge them:
...
> Center      ( 3586999.875, 5923000.125)
> Band 1 Block=8000x1 Type=Byte, ColorInterp=Palette
>  Image Structure Metadata:
>    NBITS=1
>  Color Table (RGB with 2 entries)
>    0: 255,255,255,255
>    1: 0,0,0,255
> 
> i merge with gdal_merge by following command:
> 
> d:\cad\FWTools2.4.6>gdal_merge -v -o C:\temp\geesthacht\gh_test.tif -of 
> GTiff -co COMPRESS=LZW c:\temp\geesthacht\586922g.tif 
> c:\temp\geesthacht\586922h.tif

Jan,

The input images are paletted and for no obvious reason gdal_merge.py
requires you to specify that you want to copy the color table from the
first image to the resulting mosaic with the -pct switch.

Try adding that in your gdal_merge command invocation.

PS. if you looked at your merge in some viewers, I'm sure you would
find some pixels are zero and some are one.  But in many viewers they
will just look like black and so-slightly-less-black as to be
indistinguishable.

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