Previously in the PDf Optimization In-depth Series.

Resizing images

Resizing images can provide significant gains in occupancy.

For example, decreasing unnecessary high resolutions can dramatically reduce the file size without affecting the viewing experience. But sometimes it is also a pretty destructive approach.

There exist many sophisticated resizing algorithms, but it is rare to obtain a result that does not significantly degrade the perception of the image.

An interesting alternative may be to resize only the chrominance channel.

In the sub-sampling method of chrominance, certain color spaces make a separation between brightness and color information.

Human vision is less sensitive to color than to brightness. This permits to reduce, or undersample, chrominance information without degrading the perceived quality of the image.

The resampling process recreates an image from scratch. The destination image with the given dimensions is created, and the values for each pixel are computed based on the source image. Chroma subsampling method favors less resolution for chroma information than for luma information in the resulting image.

The JPEG and JPEG2000 compression schemes

[link to article 4] enable the usage of this chrominance downsampling method.
Feel free to try it with GdPicture.NET here.

The average space saved by this method is 20%. However, 60% of images encoded in JPEG do not use it.

Color detection

Automatic color detection detects the original color of images scanned in color mode and converts the black and white or grayscale ones to the appropriate bpp (bits-per-pixel) encoding.

This approach, although destructive, produces excellent results in terms of quality and compression rate improvement. It results in very fast and unattended optimizations of image and PDF archives.