[Gdal-dev] GeoTIFF and CCITTRLE compression

Frank Warmerdam warmerdam at pobox.com
Thu Nov 2 12:49:48 EST 2006


Markus Neteler wrote:
> Hi,
> 
> I was asked to fix some ArcInfo generated TIF/TWF files
> to Geotiff to include the projection info.

...

> Using
> gdal_translate -a_srs EPSG:26591 -co COMPRESSION=CCITTRLE ...
> does not quite work since CCITTRLE isn't supported (AFAIK).
> Also the color table is expanded a lot to 0..255.
> 
> My questions are:
> - how to compress in a similar way (since we cannot preserve CCITTRLE)?
> - is the color table expansion harmful (it looks ok, but will it be
>   understood everywhere)?

Markus,

If you compress with something like "-co COMPRESS=DEFLATE" you should return
things relatively close to the original file size.

The color table change is not likely harmful to most applications, but of
course the core problem is that GDAL's GeoTIFF driver does not support
writing 1bit files, so things are expanded to 8bit.  This file is
quite different than the original.

If you want to preserve a file that is closer to the original you might want
to use the following steps.

  o Use listgeo on the file you produced with gdal_translate to capture the
    proper GeoTIFF tag values.
  o Use geotifcp with the original file as input, and the geotiff tags from
    the above listgeo command.  This *should* produce a file much like the
    original but with the geotiff tags updated.

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