Adaptive Image Servlet adaptive-image-servlet

Learn how the Core Components uses the Adaptive Image Servlet for image delivery and how you can optimize its use.

Adaptive Image Servlet or Web-Optimized Image Delivery? options

The Image Core Component can use two methods to deliver images.

  • The Adaptive Image Servlet is the default.
  • Web-optimized image delivery is available to AEMaaCS and reduces download size by 25% on average.

This document describes the default Adaptive Image Servlet.

Overview overview

By default, the Image Component uses the Core Component’s Adaptive Image Servlet to deliver images. The Adaptive Image Servlet is responsible for image processing and streaming and can be leveraged by developers in their customizations of the Core Components.

Rendition Selection rendition-selection

The Adaptive Image Servlet will automatically select the most appropriate rendition to display based on the size of the container in which it is displayed. The rendition selection process is as follows.

  1. The Adaptive Image Servlet reviews at all available renditions of the image asset.

  2. It selects only those with the same mime/type of the original referenced asset.

    • E.g. if the original asset was a PNG, it will only consider PNG renditions.
  3. Of those renditions it considers the dimensions, and comparing them to the size of the container in which the image should be displayed.

    1. If the rendition is >= the container size, it is added to a list of candidate renditions.
    2. If the rendition is < the container size, it is disregarded.
    3. These criteria ensure that the rendition will not be upscaled, which would impact image quality.
  4. The Adaptive Image Servlet then picks the rendition with the smallest file size from the candidate list.

Optimizing Rendition Selection optimizing-rendition-selection

The Adaptive Image Servlet will try to pick the best rendition for the requested image size and type. It’s recommended that DAM renditions and Image component allowed widths are defined in sync so that the Adaptive Image Servlet does as little processing as possible.

This will improve performance and avoid some images not being correctly processed by the underlying image processing library.

Using Last-Modified Headers last-modified

Conditional requests via the Last-Modified header are supported by the Adaptive Image Servlet, but the caching of the Last-Modified header needs to be enabled in the Dispatcher.

The AEM Project Archetype’s sample Dispatcher configuration already contains this configuration.