Previously published in the PDf Optimization In-depth Series:
- 1. Introduction to the Optimization of Existing PDF files: Methods
- 2. Lossless Methods: Optimization of Document Content
- 3. Lossless Methods: Compression of Streams and Fonts
Sometimes, when acceptable or necessary, it may be interesting to recompress images already included in an existing PDF file to reduce the file size.
The PDF specification allows for seven compression schemes for such purposes. All of them can be used to compress images.
Among these different compression schemes, two offer particularly beneficial optimization opportunities: JPEG2000 for 24-bit color and 8-bit grayscale images and JBIG2 for bitonal images, usually black and white.
- The compression is often much better than all other schemes for color images. Some sources mention a 20% improvement in compression efficiency over the JPEG standard.
- The scheme allows choosing a compression ratio adjustment, which will vary the quality of the produced image.
- It offers impressive results in terms of quality on the colored text as part of an MRC compression.
- It also brings an optional lossless compression mode. Lossless JPEG2000 files are about half the size of the original as indicates some sources.
- The scheme is not available for PDF standards below 1.5, including the PDF/A-1a and PDF/A-1b imposed as standard for exchange and retention by some jurisdictions.
- Decompression can be very slow, especially on very high definition images. This fact can alter the user experience with some viewers.
- It provides little compression vs. quality benefit on small images, especially photos.