[Gdal-dev] gdal_merge and gdalwarp: Problems with 1 bit data

uwe.schmitz at lverma.nrw.de uwe.schmitz at lverma.nrw.de
Tue Oct 16 02:57:15 EDT 2007


Hi,

gdal_merge and gdalwarp seem to have problems writing RasterBands
with 1 Bit depth. I'm using gdal-1.4.2 with old
python bindings(also tested with FWTools-1.3.7).

Let say I have a file called src.tif, where tiffinfo
shows:
TIFF Directory at offset 0x4bbd24
  Subfile Type: (0 = 0x0)
  Image Width: 6299 Image Length: 6299
  Resolution: 400, 400 pixels/inch
  Bits/Sample: 1
  Compression Scheme: None
  Photometric Interpretation: min-is-white
  FillOrder: msb-to-lsb
  Orientation: row 0 top, col 0 lhs
  Samples/Pixel: 1
  Rows/Strip: 6299
  Min Sample Value: 0
  Max Sample Value: 1
  Planar Configuration: single image plane

and gdalinfo reports:
Driver: GTiff/GeoTIFF
Size is 6299, 6299
Coordinate System is:
PROJCS["DHDN / Gauss-Kruger zone 2",
...
Band 1 Block=6299x10 Type=Byte, ColorInterp=Palette
  Metadata:
    NBITS=1
  Color Table (RGB with 2 entries)
    0: 255,255,255,255
    1: 0,0,0,255

Here I'm a little bit astonished to see Type=Byte 
and ColorInterp=Palette, but may be it's caused by 
abstraction of the interface.

Now if I do the following:

gdal_merge.py -co NBITS=1 -o dst.tif src.tif

the resulting file x.tif looks very jagged. Is this
a known problem?

I have to mention that gdal_translate doesn't have
this problem.

Greetings
Uwe




More information about the Gdal-dev mailing list