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

Even Rouault even.rouault at mines-paris.org
Wed Dec 9 12:45:54 EST 2009


Jan,

I see 2 issues :
1) your 2 images have the same spatial extent ! So gdal_merge has 
nothing to merge really... It will just copy the data from the second 
image on top of the data from the first image I think.
2) the images have a color table. But by default, gdal_merge doesn't 
copy it to the target file. You'd have to add the -pct option on the 
command line for that.

Best regards,

Even

Jan Tappenbeck a écrit :
> hallo !
>
> i had two tif-image and want to merge them:
>
> d:\cad\FWTools2.4.6>gdalinfo c:\temp\geesthacht\586922g.tif
> Driver: GTiff/GeoTIFF
> Files: c:\temp\geesthacht\586922g.tif
>       c:\temp\geesthacht\586922g.tfw
> Size is 8000, 8000
> Coordinate System is `'
> Origin = (3585999.875000000000000,5924000.125000000000000)
> Pixel Size = (0.250000000000000,-0.250000000000000)
> Metadata:
>  TIFFTAG_SOFTWARE=IrfanView
>  TIFFTAG_XRESOLUTION=508
>  TIFFTAG_YRESOLUTION=508
>  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
> Image Structure Metadata:
>  COMPRESSION=CCITTFAX4
>  INTERLEAVE=BAND
>  MINISWHITE=YES
> Corner Coordinates:
> Upper Left  ( 3585999.875, 5924000.125)
> Lower Left  ( 3585999.875, 5922000.125)
> Upper Right ( 3587999.875, 5924000.125)
> Lower Right ( 3587999.875, 5922000.125)
> 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
> -----------------------------
>
> d:\cad\FWTools2.4.6>gdalinfo c:\temp\geesthacht\586922h.tif
> Driver: GTiff/GeoTIFF
> Files: c:\temp\geesthacht\586922h.tif
>       c:\temp\geesthacht\586922h.tfw
> Size is 8000, 8000
> Coordinate System is `'
> Origin = (3585999.875000000000000,5924000.125000000000000)
> Pixel Size = (0.250000000000000,-0.250000000000000)
> Metadata:
>  TIFFTAG_SOFTWARE=IrfanView
>  TIFFTAG_XRESOLUTION=508
>  TIFFTAG_YRESOLUTION=508
>  TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
> Image Structure Metadata:
>  COMPRESSION=CCITTFAX4
>  INTERLEAVE=BAND
>  MINISWHITE=YES
> Corner Coordinates:
> Upper Left  ( 3585999.875, 5924000.125)
> Lower Left  ( 3585999.875, 5922000.125)
> Upper Right ( 3587999.875, 5924000.125)
> Lower Right ( 3587999.875, 5922000.125)
> 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
>
> but when i open the resultfile it is black-complete! !
>
> d:\cad\FWTools2.4.6>gdalinfo c:\temp\geesthacht\gh_test1.tif
> Driver: GTiff/GeoTIFF
> Files: c:\temp\geesthacht\gh_test1.tif
> Size is 8000, 8000
> Coordinate System is `'
> Origin = (3585999.875000000000000,5924000.125000000000000)
> Pixel Size = (0.250000000000000,-0.250000000000000)
> Image Structure Metadata:
>  COMPRESSION=LZW
>  INTERLEAVE=BAND
> Corner Coordinates:
> Upper Left  ( 3585999.875, 5924000.125)
> Lower Left  ( 3585999.875, 5922000.125)
> Upper Right ( 3587999.875, 5924000.125)
> Lower Right ( 3587999.875, 5922000.125)
> Center      ( 3586999.875, 5923000.125)
> Band 1 Block=8000x1 Type=Byte, ColorInterp=Gray
>
>
> can anybody tell me why ?????
>
> regards Jan :-)
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>




More information about the gdal-dev mailing list