image_filter_interlace
The image_filter_interlace directive enables interlacing for images processed by the image filter module in NGINX.
Description
The image_filter_interlace directive is used to control how images are served to clients, particularly in relation to progressive rendering. When interlacing is enabled, images are sent to the browser in a way that allows them to load and display progressively, enhancing the user experience for large images over slower connections. The directive accepts a boolean flag: 'on' enables interlacing, while 'off' disables it. This means that developers can choose whether to serve images in a format that allows progressive display based on their specific use case and performance considerations.
The command can be configured within the http, server, or location contexts, thus allowing it to be applied globally or more narrowly to specific locations. For example, enabling this directive can be particularly beneficial when serving gallery images on a website, as it allows users to see a low-resolution version of the image as it loads, rather than a long wait for a high-resolution image to fully render. It’s important to note that interlacing is typically only supported by certain image formats (such as PNG and JPEG) and may not provide benefits for all image types or scenarios. In environments where image loading performance is a concern, testing both scenarios may be warranted to determine which offers the best user experience.
Config Example
location /images/ {
image_filter on;
image_filter_interlace on;
}Interlacing primarily affects images that support progressive loading like JPEG and PNG; other formats may not benefit.
Some browsers may not render interlaced images optimally, depending on the connection speed and other factors.