ImageGear .NET v25.2 - Updated
Native JPEG and PNG Filters
Developer Guide > File Formats and Compressions > File Formats > File Formats Reference > Native JPEG and PNG Filters

To improve working with the most frequently used file filters, JPEG and PNG, two alternative filters were designed for these formats. Since the implementation of these filters is based on the C/C++ language, there is significant improvement in speed of saving and loading these formats. A separate set of control parameters was developed for these filters to create more compact files while saving. To achieve these goals, some functionality of managed filters is not included in native filters. However, using both managed and native filters helps achieve the appropriate result.

The following tables describes the difference between using managed and native filters.

JPEG File Filter

Functionality

Native Filter

Managed Filter

Description

Quality and Compression

SaveCosited, Chrominance, Luminance, Subsampling and UseOptimizedHuffmanCode control parameters

Quality and DecimationType control parameters

Quality and level of compression lies on different scales. The higher the compression level, the lower the quality, and vice versa. However, the JPEG format relies on the human eye to more sensitively distinguish gradations of brightness than gradations of color. Therefore, the native filter uses separate compression parameters for luminance and chrominance. Moreover, the gradation of these parameters is higher than in managed Compression control parameter. SaveCosited parameter allows the use of cosited subsampling during compression that provides better compression. After reducing the chrominance on DCT, each component is compressed with Huffman algorithm.
Managed filter uses standard Huffman table. Native filter with UseOptimizedHuffmanCodes set to "true" calculates the Huffman table for best compression. Subsampling for native filter and DecimationType for managed filter are equal.

Save type

JpegSaveType control parameter

SaveType control parameter

Unlike the managed filter, the native filter allows saving a Progressive type of JPEG. In this mode, saving the raster is being done to add details to the image. This allows you to get an idea of the picture before it is fully loaded. This functionality is useful when transferring pictures over the Internet.

Four component image reading

QuadComponentColorSpace control parameter

QuadComponentColorSpace control parameter

Both filters have this control parameter. This parameter defines colorspace of a four component image. Not all files contain information about it. Unlike the native filter, the managed filter allows to account for the four components as YCCK colospace.

Working with Metadata

Filter does not support options for metadata

SaveEXIFMetadata and SaveExistingEXIFMetadata control parameters

The managed filter allows saving EXIF metadata to JPEG file even if the metadata does not exist in data in memory. This filter adds default EXIF metadata. The native filter does not have such functionality.

PNG File Filter

Functionality

Native Filter

Managed Filter

Description

Compression

Filter control parameter

CompLevel control parameter

PNG files keep compressed images with lossless compression so that the compression in the PNG does not affect the image quality. Managed filters provide 9 levels of compression but does not provide the functionality to select the filter. Native filters do not provide levels of compression and always uses maximal level of compression. Additionally, native filters provide control for raster filtering.
Filtering in PNG is preparation of the raster during saving and depends on the information in the compressed raster and previous raster. It allows you to make compressing information even smaller before compression that additionally decreases the size of the saved file. Optimal value allows selecting the best filter for raster. As a result, in most cases, the size of the PNG file saved with the native filter is smaller than that saved with the managed filter.

Saving options

Interlaced control parameter

StripConfig, BufferSize and StripCount control parameters.

The interlaced option of native filter allows saving raster with interlace lines. The first part of the data is odd lines and second part of the data is even lines. It allows displaying the image before it is loaded completely. This option is useful when the image is downloaded via the Internet.
StripConfig, BufferSize and StripCount of the managed filter provides options to distribute raster data by chunks. It influences the size of IDAT chunks in saved files.

Alpha channel saving

KeepAlpha control parameter

KeepAlpha control parameter.

This option is similar for both filters and specifies how the alpha channel will be saved to a PNG file.

 

Is this page helpful?
Yes No
Thanks for your feedback.