Opened 18 years ago

Closed 16 years ago

#1174 closed enhancement (fixed)

[PATCH] Enhancement request : specify Tiff Deflate compression level

Reported by: quickstuff@… Owned by: Even Rouault
Priority: normal Milestone: 1.5.0
Component: GDAL_Raster Version: unspecified
Severity: minor Keywords: gtiff deflate
Cc: warmerdam

Description (last modified by warmerdam)

Creation of Deflate-compressed TIFF datasets lack a creation-option allowing to
specify the desired compression level.
(so-called zlevel 0-9 in zlib / pseudo-tag TIFFTAG_ZIPQUALITY in libtiff)

Attachments (1)

gdal_svn_trunk_deflate_compression_level_1174.patch (2.8 KB ) - added by Even Rouault 16 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by Even Rouault, 16 years ago

Keywords: gtiff deflate added
Milestone: 1.5.0
Owner: changed from warmerdam to Even Rouault
Summary: Enhancement request : specify Tiff Deflate compression level[PATCH] Enhancement request : specify Tiff Deflate compression level

Patch provided adding this feature. The only point I'm unsure is the name of the creation-option. I've chosen 'ZLEVEL'. I find ZIPQUALITY a bit confusing (it's a lossless compression).

comment:2 by Even Rouault, 16 years ago

Cc: warmerdam added

comment:3 by warmerdam, 16 years ago

Description: modified (diff)

Even,

This patch looks great, go ahead and apply it in trunk.

comment:4 by Even Rouault, 16 years ago

Resolution: fixed
Status: newclosed

Commited in trunk in r12575

comment:5 by quickstuff, 16 years ago

Resolution: fixed
Status: closedreopened

Though the enhancement worked under FWTools 1.4.x, the option ZLEVEL appears to do nothing with subsequent versions (FWTools 2.0.x) based on GDAL 1.5 betas.

Tested with FWTools 2.0.3 Win32:

gdal_translate -of GTiff -co COMPRESS=DEFLATE -co ZLEVEL=9 source.tif dest.tif

Whatever the number used (1...9) the destination file always has exactly the same size/compression ratio.

comment:6 by warmerdam, 16 years ago

Even,

In our discussion in IRC was I was mixed up about tiffcp. The argument for zip compression is predictor. In fact, I think your earlier analysis is correct and that this isn't a libtiff problem. The difference (I think) was the gutting of GTiffCreateCopy() and change to close, reopen and then use GDALDatasetCopyWholeRaster(). So the change in behavior wasn't (I think) in libtiff, but in geotiff.cpp. Setting the zipquality after the reopen would appear to be the right solution.

I've leave it in your hands.

comment:7 by Even Rouault, 16 years ago

Resolution: fixed
Status: reopenedclosed

Fix commited in r13326. I've also fixed JPEG_QUALITY that has the same behaviour.

Note: See TracTickets for help on using tickets.