[gdal-dev] LZW Compression on geotiffs

David Strip gdal at stripfamily.net
Wed Oct 1 08:03:18 PDT 2014


I was sufficiently intrigued by this result that I tried on some 3-band
aerial data I had handy. My data is from over Phila, PA. Here are the
results for various compression/tiling combinations. It's quite
different from yours

  93,784,427 out_none.tif

 73,241,943 out_deflate.tif
 59,786,628 out_deflate_tiled.tif
 
 93,191,345 out_lzw.tif
 78,036,699 out_lzw_tiled.tif

 94,516,744 out_pack.tif
 94,552,019 out_pack_tiled.tif

As Even noted, it's not surprising that some compression methods, esp.
packbits which is a very simple compression, would not have much effect,
and in fact actually increased file size. More surprising would be that
LZW and deflate don't save space. In my case, tiling made a big difference.

On 10/1/2014 8:32 AM, Even Rouault wrote:
> Le mercredi 01 octobre 2014 16:26:15, Newcomb, Doug a écrit :
>> Well,
>> I went back and compiled with 1.11.1 with the external geotiff library and
>> got the same result for LZW, tiling made no difference in size .
>>
>> As an interesting sideline, I noticed that I had not been compiling with
>> LZMA compression  previously and compiled gdal 1.11.1 with LZMA.  I ran:
>>
>>
>> gdal_translate -of “GTIFF” -co “COMPRESS=LZMA” on the original file and got
>> a file of  149MB in size.
>>
>>  I noticed that LZMA compression is not listed as one of the compression
>> options for the GeoTIFF format in the online documentation.  Has that
>> capability been available long?
> GDAL 1.8.0. Should likely be documented. Caution: GeoTIFF LZMA compression is 
> something that is far from being standard. Probably only GDAL LZMA-enabled 
> builds with internal libtiff (or with external libtiff 4.0.X built against 
> liblzma) will be able to deal with that.
>
> If that's an option for you, you could try lossless JPEG2000 compression. See 
> http://www.gdal.org/frmt_jp2openjpeg.html and the "Lossless compression" 
> paragraph.
>
>> Doug
>>
>> On Wed, Oct 1, 2014 at 9:45 AM, Even Rouault <even.rouault at spatialys.com>
>>
>> wrote:
>>> Le mercredi 01 octobre 2014 15:41:06, Newcomb, Doug a écrit :
>>>> Hi,
>>>> I have a 4 band uncompressed geotiff ( NAIP data for North Carolina,
>>>> USA) that is 193 MB
>>>> I've been going over the compression options for gdal_translate 
>>>> geotiffs and I note the following:
>>>> gdal_translate -of “GTIFF” -co “COMPRESS=PACKBITS” gives me a file that
>>> is
>>>
>>>> 194MB in size
>>>> gdal_translate -of “GTIFF” -co “COMPRESS=LZW” gives me a file that is
>>> 232MB
>>>
>>>> in size
>>>> gdal_translate -of “GTIFF” -co “COMPRESS=DEFLATE” gives me a file that
>>>> is 177MB in size
>>>>
>>>> Of the above  Lossless compression options for geotiff, it seems that
>>>> DEFLATE is the only one actually compressing.
>>>>
>>>> I'm running gdal 1.11.0 on Ubuntu 12.04.3 64 bit compiled with
>>> ./configure
>>>
>>>> --with-libz   --with-png  --with-libtiff=internal
>>>>
>>>>  --with-geotiff=internal   --with-jpeg=internal   --with-openjpeg
>>>>
>>>> --with-pg=/usr/local/pgsql/bin/pg_config --with-ogr --with-xerces
>>>> --with-geos --with-hdf4 --with-hdf5 --with-poppler=/usr/local/lib
>>>> --with-podofo --with-spatialite --with-netcdf
>>>>
>>>> Is this expected behavior?
>>> Doug,
>>>
>>> Not completely surprising that lossless methods don't work well with
>>> aerial/satellite imagery.
>>> You may also want to test with -co TILED=YES .
>>>
>>> Even
>>>
>>> --
>>> Spatialys - Geospatial professional services
>>> http://www.spatialys.com





More information about the gdal-dev mailing list