Manual Chapter : Accelerating Images with Image Optimization

Applies To:

Show Versions Show Versions


  • 11.5.10, 11.5.9, 11.5.8, 11.5.7, 11.5.6, 11.5.5, 11.5.4, 11.5.3, 11.5.2, 11.5.1
Manual Chapter

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.

Note: Image optimization only benefits raster images. Vector images, such as SVG files, benefit little from image optimization, but can benefit from file compression. You can use file compression to improve the performance of vector images.

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 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.

Note: If necessary, you can preserve copyright metadata when you strip other metadata from the EXIF header, by selecting the Strip EXIF keeps copyright check box.

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.