0
votes

Can anyone explain why Photoshop compress .TIF files (with no layers) in ZIP format better than any archiver? Example:

Original .TIF file size: 39.2. Compressed by 7-Zip: 29.5. Compressed by Photoshop: 18.1.

It is known that ZIP compression mode in Photoshop uses Zlib library, wherein a Deflate compression algorithm. The same algorithm was tested with this file in 7-Zip archiver.

1

1 Answers

0
votes

This TIFF Technical Note has some comments on ZIP compression in the TIFF file format:

Deflate is a byte-oriented compression scheme which can be applied to a TIFF image regardless of its Photometric Interpretation, Planar Configuration, or image data organization (strips or tiles). Each strip or tile (we will use the term image segment to refer to either) is compressed independently, and stored as a complete zlib data stream.

Note the last part, "compressed independently". I suppose the data in your test files is stored in strips or tiles and for an external Deflate tool like 7-Zip that doesn't know about the strip/tile structure, the "scrambled" data will compress less efficient as for the internal Deflate in TIFF that can reorganize the data and compress strips/tiles independently.

To understand this, look at the following analogous example: If you had an image with 24 bit color depth, you can store the data by concatenating RGB triples for each pixel. So without knowledge about the structure of this data, you'll have to compress data in the format RGBRGBRGB... but if you know about the structure, you can transform the data to 3 seperate streams RRR..., GGG..., BBB... that most likely will compress better.