Lossless, Lossy, and Perceptually Lossless Compression
A lossless JBIG2 encoding keeps the image exactly identical to the image at the time of scan. This JBIG2 mode, which typically achieves compression rates up to 2x smaller than a TIFF G4 encoding, does not allow for any image transformations (e.g., deskewing, rescaling, font matching, and despeckling). A comparison of relative file sizes for TIFF G4, G4-coded PDF, lossless JBIG2, and lossless JBIG2-coded PDF is given in the table that follows.
As can be seen from the table, there is virtually no file size difference between G4 and PDF-wrapped G4 or between JBIG2 and PDF-wrapped JBIG2. In general, there is minimal overhead for PDF-wrapping of a compression format, assuming the format is supported within the PDF specifications. For most users the additional functionality and accessibility of PDF-wrapping is well worth the slight increase in file size.
The advantage of lossless encoding is that the image quality is guaranteed to be the same as the original. If a user doesn’t trust a JBIG2 vendor to make the critical decisions necessary for effective lossy or perceptually lossless compression, lossless would be their safest option. Even within lossless compression there are many ways of implementing it, and the differences between competing vendors can be significant. In addition to differences in compression ratio, there can also be dramatic differences in both the speed of the encoding and in the latency of displaying and printing the compressed files.
Lossy compression has been roughly defined as “any method of data compression that reconstructs the original data approximately, rather than exactly.” Lossy JBIG2 image coding can result in dramatically reduced file sizes. Of course, file size reduction is good. The table below compares file sizes for lossy and lossless JBIG2.
The problem with lossy JBIG2 is that some implementations are exactly that – lossy. Lossy JBIG2, implemented naively by an unqualified vendor, may significantly degrade image quality. In many document management applications with record retention policies, such as mortgage banking and medical fields, lossy JBIG2 coding is problematic and must be used with caution. A lossy JBIG2 file encoding may result in significant image artifacts and degraded text recognition rates, e.g., fewer word hits when the file is converted to text using an OCR program.
While lossy compression offers superior compression to lossless JBIG2, for many corporate and professional users the loss of document integrity would not be worth the trade-off. Yet when utilized properly, the techniques of lossy compression can actually improve image quality. With a proper JBIG2 implementation you can drastically reduce file size even as you create a cleaner, more readable document.
Perceptually Lossless Compression
When JBIG2 compression is done properly, any perceptual differences between the compressed file and the original will be enhancements and not degradations
When the compressed image appears indistinguishable from the original scanned document, it is called perceptually lossless.
It is crucial to distinguish between an implementation that sacrifices image quality in order to get a compression savings and one that gets a compression savings through improving image quality. Perceptually lossless JBIG2 mode is where there appears to be significant ROI (return on investment) for the digital imaging industry. This is the mode where digital devices and document management systems can see real benefit from utilizing JBIG2 technology. It truly provides the best of both worlds. The file size is similar to what a naive JBIG2 lossy implementation produces, while the image quality of the original is maintained or even improved.
In review, the most effective compression rates for JBIG2 files are achieved using lossy compression methods. Such methods include machine learning of image font classes and halftone patterns. These methods are called “lossy,” for they enable the compressed file to differ in appearance from the original image. It is important that these methods be used judiciously, for they have the ability to severely degrade an image. A good JBIG2 implementation will always ensure that all lossy methods adhere to the rigorous standard of being perceptually lossless. While the JBIG2 specifications do not require this, it is clearly a desired (if unstated) objective. When JBIG2 compression is done properly, any perceptual differences between the compressed file and the original will be enhancements and not degradations.