Applies To:Show Versions
- 12.1.4, 12.1.3, 12.1.2, 12.1.1, 12.1.0
Accelerating Images with Image Optimization
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 JPEG-XR
Application Acceleration Manager™ now recognizes and converts images to JPEG-XR. JPEG-XR is an image format that offers both lossless and lossy compression with better quality per byte than JPEG. JPEG-XR is useful for compressing existing JPEG, GIF, PNG, or TIFF images. Compressed images can be significantly smaller in percentage compared to PNG or JPEG. When enabled, Application Acceleration Manager™ will convert the images only when the request comes from a browser that supports JPEG-XR. JPEG-XR is supported natively in some browsers and in others, through plug-ins.
Browsers that support JPEG-XR:
- Internet Explorer 9+
- Internet Explorer Mobile
Optimization with WebP
Application Acceleration Manager™ now recognizes and converts images to WebP. WebP is an image format developed by Google that offers both lossless and lossy compression with better quality per byte than JPEG. WebP is useful for compressing existing JPEG, GIF, PNG, or TIFF images. Compressed images can be significantly smaller in percentage compared to PNG or JPEG. When enabled, Application Acceleration Manager™ will convert the images only when the request comes from a browser that supports WebP. WebP is supported natively in some browsers and in others, through plug-ins.
Browsers that support WebP:
- Chrome 9+
- Opera 12+
- Opera Mobile 11+
- Android Ice-Cream Sandwich 4.0+
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.