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

Frank Warmerdam warmerdam at pobox.com
Tue Oct 16 14:55:50 EDT 2007


uwe.schmitz at lverma.nrw.de wrote:
> 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).

Uwe,

I was not aware that GDAL 1.4.2 had any support for
writing 1bit files.  FWTools does though.

> 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.

One bit TIFF files have values 0 and 1.  To get this
to display as black and white GDAL abstracts it to be
a paletted image.  Note the GDAL data model does not
directly support 1bit data so we have to promote to byte.

> 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'm not sure what jagged means.  I tried a quick
gdalwarp to 1 bit file using gdal trunk and it seemed
to work fine.  I would suggest you file a detailed
bug report.  You might even want to try first with
FWTools 1.3.9.  There were some issues with FWTools
geotiff support for a couple revs recently due to the
bigtiff upgrade.

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    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list