Applies To:Show Versions
Overview: Accelerating images with image optimization
You can configure image optimization in a BIG-IP policy to reduce the size of image files, for example, by removing unnecessary metadata, by changing the format, or by increasing compression, and, consequently, accelerate the transfer of image objects across a network.
When an image object is matched to a policy node, it is modified in accordance with the acceleration rules of the policy. Configurable acceleration rules for an image object include several parameters.
Optimization of image format
An image of a supported format can be converted into any other supported format, although features of the original format that are not supported by the target format are lost upon conversion. For example, conversion of an animated GIF or multipage TIFF into a PNG only converts the first image from the original animated GIF or multipage TIFF into the PNG. Similarly, an original file loses transparency upon conversion if the target format does not support transparency.
The number of bytes after conversion typically varies from the number of bytes before conversion. Ideally, you will want to convert a file to produce a smaller file size; however, a requested conversion occurs even if the output produces a larger file size, except for conversion to PNG which only occurs if the converted file is smaller.
Typically, converting a GIF into a PNG, or converting a large PNG into a JPEG, depending upon the selected JPEG quality factor (level of compression), produces a smaller file size. Conversely, converting a supported format into a TIFF often produces an increase in file size. F5 Networks recommends examination of converted file sizes for different formats to optimize performance with a reduced file size.
If the BIG-IP device converts an image into a different format, it generates a correct Content-Type header, but it does not change the URL (which might include a file extension) in the HTML page that refers to the image.
Optimization with file compression
When an optimized image is a JPEG, you can set a quality level that ranges from 1 (low quality and maximum compression) through 100 (high quality and minimum compression).
Absolute compression specifies the quality level directly. A practical value for the quality level is from 30 to 100. You can perform absolute compression of a higher-quality JPEG into a lower-quality JPEG, but not the reverse.
If the original image is JPEG, and, therefore has a quality factor, relative compression specifies the new quality as a percentage relative to the original quality.
Optimization of headers
A JPEG image might contain an optional exchangeable image format (EXIF) header, which includes metadata, such as a date, time, author, copyright, camera model, exposure settings, global positioning coordinates, and possibly a color profile. This optional header can vary considerably in size, and does not affect display of the image (unless it contains a color profile). The EXIF header can be a significant fraction of the image; consequently, removing it can be advantageous.
You can select one of the following options for the EXIF header.
- Don't Strip EXIF. The EXIF header is not changed.
- Always Strip EXIF. The EXIF header is always removed from the JPEG file.
- Strip EXIF if safe. The EXIF header is always removed, unless the header includes a color profile.
- Apply color profile, then strip EXIF. After the color profile is applied, the EXIF header is always removed. Use this option to convert the image to the default color profile, so that the EXIF header can be safely removed.
Optimization of sampling factor
Because human eyes perceive small changes in brightness, but not small changes in color, you can frequently use an average color for two adjacent pixels, horizontally (2x1), vertically (1x2), or both (2x2), thus improving compression with insignificant changes in quality.
You can use one of the following options to optimize the sampling factor.
- Preserve. The sampling factor matches the brightness and color values of the original file.
- 1x1. Provides the same sampling factor for the brightness and color values.
- 2x1. Averages color values for horizontal pixels.
- 1x2. Averages color values for vertical pixels.
- 2x2. Averages color values for vertical and horizontal pixels.
Optimization with progressive encoding
With baseline encoding (default), a browser renders a JPEG image from the top to the bottom as the image file downloads. However, you can sometimes improve optimization of JPEG images larger than about 10 kilobytes by using progressive encoding, which quickly renders a low-quality version of the entire image, and continuously improves the quality as the image file downloads. For larger image files or slow network connections, users can view rendered images faster with progressive encoding.
Optimization of color values
Reducing the number of colors in a PNG image to 256 optimally chosen color values can significantly reduce the file size with minimal degradation in the quality of the image. Because GIF images already have a maximum of 256 colors, you should not use this option when converting GIF images to PNG images.