Summary: | use deflate compression for tiffs | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Dennis Gnad <bluedrago> |
Component: | Plugin-DImg-TIFF | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.9.0 | |
Sentry Crash Report: | |||
Attachments: |
identify-log of tiff file with selected "deflate" as compression in gimp
identify-log of a digikam compressed tiff file with deflate compression |
Description
Dennis Gnad
2006-04-18 01:38:12 UTC
yes adobe Deflate compression method is used in digiKam. Please, read the digiKam handbook or check widgets tool tips from setup dialog if you want more informations... Gilles I toogle this file like Invalid. Gilles Is the deflate method surely used? I checked the box "Compress TIFF Files". To test it I saved my image as 8bit and opened it in gimp, then saved it again with deflate in gimp. So it should be the same size, but then it is around 2/3 or 3/4 the size. Does gimp discard some information which is some megabytes large (would be 5MB in my example - I can't believe that!) The Exif "Image Informations" which digikam shows, shows "Rows per Strip" "1" for the digikam-saved image and "64" for the one from gimp. "Compression" and the other stuff which could mean something, is the same. Info about file sizes of one example 8bit file of me: digikam no compression: 17.2 MB digikam compressed: 15.1 MB gimp no compression: 17.2 MB gimp deflate compression: 10.0 MB gimp lzw compression: 11.1MB What is digikam doing wrong?(or correct?) Created attachment 15896 [details]
identify-log of tiff file with selected "deflate" as compression in gimp
This is a log of what "identify -verbose" shows of the tiff file with selected
"deflate" as compression in gimp, which is just 10mb larges.. it shows
"Compression: Zip" like the deflate compressed from digikam also does.. but
digikams one is 15.1mb large... next attachment will be the "identify
-verbose"-log of the digikam deflate compressed file which is 15.1mb large
Created attachment 15897 [details]
identify-log of a digikam compressed tiff file with deflate compression
SVN commit 539215 by cgilles: digikam from trunk : DImg TIFF image loader : force to use ZLib max compression level when a new image is saved to disk using Deflate compression. CCMAIL: digikam-devel@kde.org CCBUGS: 125779 M +3 -0 tiffloader.cpp --- trunk/extragear/graphics/digikam/libs/dimg/loaders/tiffloader.cpp #539214:539215 @@ -399,7 +399,10 @@ bool compress = compressAttr.isValid() ? compressAttr.toBool() : false; if (compress) + { TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_DEFLATE); + TIFFSetField(tif, TIFFTAG_ZIPQUALITY, 9); + } else TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE); Dennis, My last fix in svn have really improved the compression result. Look below : [gilles@portable-gc METADATA]$ ls -l _dsc* -rw-rw-r-- 1 gilles gilles 1750127 fév 23 16:52 _dsc0034.jpg -rw------- 1 gilles gilles 11704190 mai 26 17:12 _dsc0034.tif -rw------- 1 gilles gilles 18205760 mai 26 17:10 _dsc0034.tiff _dsc0034.jpg is the original file in 8 bits color depth (JPEG) _dsc0034.tif is a 8 bits tiff file using deflate compression _dsc0034.tiff is a 8 bits tiff file without compression. The original image is here : http://digikam3rdparty.free.fr/TEST_IMAGES/METADATA/_dsc0034.jpg Here i'm using libtiff 3.6.1. I haven't tested with last libtiff available (3.8.2) The difference with 16 bits color depth tiff image is less impressive. I don't know if it's a problem from libtiff. I all case, i think you can compare now result with Gimp-svn. Please give me a feedback. Gilles Not with Gimp-svn but I compared with Gimp 2.3.7 .. 8bit: Gimp-deflate: 9,3mb Digikam-deflate: 13,6mb something is still strange, and there is still the difference: rows per strip: gimp: 64 digikam: 1 compression: gimp: (32946) digikam: (8) SVN commit 546226 by cgilles: digikam from trunk : DImg::TIffLoader : optimize again Deflate compression ratio like gimp tiff coder done. The Predictor tiff tag must be set to '2' for the best results. Look below : #ls -l _* -rw------- 1 gilles gilles 11523474 mai 29 16:17 _dsc0034 (deflate alone).tif -rw------- 1 gilles gilles 7553642 mai 29 16:14 _dsc0034 (deflate + horizontal predictor).tif -rw------- 1 gilles gilles 18253872 mai 29 16:17 _dsc0034 (without compression).tif -rw-r--r-- 1 gilles gilles 1750127 mar 24 15:18 _dsc0034.jpg -rw-r--r-- 1 gilles gilles 10471516 mar 24 15:18 _dsc0034.png _dsc0034.jpg is the original file loaded in editor and saved like tiff files following different settings. For more details about predictor values, look here :http://www.awaresystems.be/imaging/tiff/tifftags/predictor.html Note : the implementation is compatible with libtiff 3.6.x and 3.8.x BUG:125779 CCMAIL: digikam-devel@kde.org M +4 -0 tiffloader.cpp --- trunk/extragear/graphics/digikam/libs/dimg/loaders/tiffloader.cpp #546225:546226 @@ -399,6 +399,10 @@ { TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_ADOBE_DEFLATE); TIFFSetField(tif, TIFFTAG_ZIPQUALITY, 9); + // NOTE : this tag values aren't defined in libtiff 3.6.1. '2' is PREDICTOR_HORIZONTAL. + // This value is used to optimize Deflate compression ratio. See this url for more details: + // http://www.awaresystems.be/imaging/tiff/tifftags/predictor.html + TIFFSetField(tif, TIFFTAG_PREDICTOR, 2); } else TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE); |