The lossless deflate compression algorithm is based on two other compression algorithms: Huffman encoding and LZ77 compression. You have to understand how these two algorithms work in order to understand deflate compression.
How Flate works
Deflate is a smart algorithm that adapts the way it compresses data to the actual data themselves. There are three modes of compression that the compressor has available:
- Not compressed at all. This is an intelligent choice for, say, data that’s already been compressed. Data stored in this mode will expand slightly, but not by as much as it would if it were already compressed and one of the other compression methods was tried upon it.
- Compression, first with LZ77, and then with a slightly modified version of Huffman coding. The trees that are used to compress in this mode are defined by the Deflate specification itself, and so no extra space needs to be taken to store those trees.
- Compression, first with LZ77 and then with a slightly modified version of Huffman coding with trees that the compressor creates and stores along with the data.
The data is broken up in “blocks,” and each block uses a single mode of compression. If the compressor wants to switch from non-compressed storage to compression with the trees defined by the specification, or to compression with specified Huffman trees, or to compression with a different pair of Huffman trees, the current block must be ended and a new one begun.
Advantages and disadvantages
I have no idea – add a comment if you know anything about the pros and cons.
Where is Flate/deflate compression used
I am only aware of one generic prepress application that relies on flate compression which is Adobe Acrobat. Flate compression is a standard feature of the PDF file format that Acrobat can handle.
5 thoughts on “Flate/deflate compression”
hello sir now I am trying to develop a new software of compressor in java language,shell I expect help from u?
Is flate and deflate different algorithm? can u tell how it works?
Hi, what is Flate, Inflate and Deflate with respect to pdf?
One of our pdf files has Flate Compression in it, how to remove this compression?
Since Flate is a lossless compression algorithm, decompressing that PDF file will only increase its file size, without offering any benefit (at least as far as I know). Since Flate seems to be used for compressing text as well as black&white or grayscale images, switching off the compression for those types of objects should do the trick. You do do this during the PDF creation or afterwards in Acrobat Professional.
Both gzip and zlib use the deflate algorithm. Deflate also plays a role in compressing web traffic web servers often use deflate (sometimes as gzip) to send compressed web pages.
Comments are closed.