About MRC image compression

The MRC (Mixed Raster Content) compression uses image segmentation methods to encode documents represented as color images to PDF format, applying multiple lossy compression algorithms.

Traditional compression methods apply uniform compression to the entire file content, which may be too high for some elements, too low for others, while optimal for neither. MRC separates the text elements from the pictures or backgrounds and applies optimum compression to each. For files containing both text and pictures – color or grayscale, either in the foreground or background–, MRC can result in PDF files significantly smaller than traditional PDF, while the picture quality is near the original. MRC offers no benefit for black-and-white files, for text-only or picture-only files.

An MRC PDF may incorporate the following kind of layers.:

  • Background: Contains images and the background, giving most of the size of MRC PDF files. As this no longer contains the text, CSDK aims to reduce its footprint by applying various lossy compression algorithms. This layer is encoded with JPEG or JPEG 2000 compression, depending on the trade-off parameter.

  • Selector: Also called as binary mask layer. This is a high resolution black and white layer of text encoded with either TIF_G4 or JBIG2, depending on the trade-off parameter.

  • Foreground: The foreground layer represents the color of the text.

CSDK offers five compression schemes from Level 1 to 5, with different layer structure and settings.

MRC Level 1-3 layers and compression

MRC Level 1-3 layers and compression

Levels 1, 2, and 3 uses Multi-Binary-Layer Compression, applying a background layer with multiple monochrome foreground layers, resulting in cleaner and sharper pages than traditional PDF. On a Multi-Binary-Layer MRC-compressed page, text with similar colors is extracted, combined, and encoded as a part of a monochrome layer with a color attribute. Multi-Binary-Layer MRC compressed files are much smaller than files compressed with Level 4 or 5, although pictures display less realistic. Occasional image artifacts may appear in the contour of the color text when using Level 1, 2 or 3.

Level 1 provides the smallest file size, achieved by the intense filtering and compression applied to the background while reducing its resolution for a third. CSDK uses low-quality JPG compression on the background and blurs the area around characters.

Level 2 applies less intense filtering to the background and saves it with a higher quality JPG compression.

Level 3 is a compromise between document quality and file size. CSDK filters the background even less and only halves the background resolution.

MRC Level 4 layers and compression

MRC Level 4 layers and compression

Level 4 provides superior compression by dividing a document into three layers: a binary mask layer (selector layer), a foreground layer, and a background layer. The foreground layer represents the color of the text with a low resolution. CSDK filters the background layer lightly and only halves its resolution. The foreground and background are encoded with JPEG or JPEG 2000 compression, depending on the trade-off parameter. Refer to the RecAPI documentation (Kernel.Imf.CompressionTradeoff) for details.

In CSDK 21.1, Level 4 was used in the top (Level 5) position, serving as a scheme for LOSSLESS compression.

MRC Level 5 layers and compression

MRC Level 5 layers and compression

Level 5 (SUPERB) adds Imagettes to Level 4. When using Level 5, CSDK 2025.1 automatically looks for graphics, diagrams, and photos on the page. Parcels these elements into high quality sections (called Imagettes), placing them on the top of the three standard layer (background, selector, and foreground) with high resolution. At the same time, it smooths out the pixel errors and triples the resolution of the text (selector) layer, greatly improving character contour. As a result, PDF readers display the text contour smoother than on the source image, even at high zoom levels. The quality of the photos keeps close to the original. On the other hand, the same image compressed with Level 5 MRC concludes a larger file size than with Level 4.

Use the kRecSetCompressionLevel function to set the MRC compression level:

RECERR RECAPIKRN kRecSetCompressionLevel (int sid,
                                          int CompressionLevel
                                          )