[Gdal-dev] gdal_merge: output colors reverted

Maciek Sieczka werchowyna at epf.pl
Fri Dec 9 13:33:39 EST 2005


Frank,

I have 2 tif+tfw B/W (black on white) sheets of topo map. Both are
something like this (they only differ very slighlty in pixel size and
size):

maciek at sorbus:~/tmp/kor$ gdalinfo 442_132_kor_trim.tif
Driver: GTiff/GeoTIFF
Size is 7999, 5000
Coordinate System is `'
Origin = (3655999.644128,5630000.159623)
Pixel Size = (1.00019000,-1.00019000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_DOCUMENTNAME=NONE
  TIFFTAG_SOFTWARE=TSL Raster Converters, Version 4.0
  TIFFTAG_DATETIME=2005:12:07 17:38:53
  TIFFTAG_XRESOLUTION=300
  TIFFTAG_YRESOLUTION=300
  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
Corner Coordinates:
Upper Left  ( 3655999.644, 5630000.160)
Lower Left  ( 3655999.644, 5624999.210)
Upper Right ( 3664000.164, 5630000.160)
Lower Right ( 3664000.164, 5624999.210)
Center      ( 3659999.904, 5627499.685)
Band 1 Block=7999x5000 Type=Byte, ColorInterp=Palette
  Color Table (RGB with 2 entries)
    0: 255,255,255,255
    1: 0,0,0,255



When I gdal_merge them, the resulting file is not visible at all in
OpenEV and visible as white-on-black in QGIS, instead of original
black-on-white. Why do these happen?



Here's the gdalinfo of my problematic gdal_merge output:

maciek at sorbus:~$ gdalinfo topo_mosaick_subset.tif
Driver: GTiff/GeoTIFF
Size is 15997, 5000
Coordinate System is `'
Origin = (3655999.644128,5630000.310932)
Pixel Size = (1.00019000,-1.00019000)
Corner Coordinates:
Upper Left  ( 3655999.644, 5630000.311)
Lower Left  ( 3655999.644, 5624999.361)
Upper Right ( 3671999.684, 5630000.311)
Lower Right ( 3671999.684, 5624999.361)
Center      ( 3663999.664, 5627499.836)
Band 1 Block=15997x1 Type=Byte, ColorInterp=Gray



gdal_translate and gdalwarp preserve colors properly. Could gdal_merge
too?

GDAL 1.3.1 CVS 15.11.2005, Linux.

Maciek


--------------------
W polskim Internecie s± setki milionów stron. My przekazujemy Tobie tylko najlepsze z nich!
http://katalog.epf.pl/




More information about the Gdal-dev mailing list