jpeg_filter_max_pixel

Sets a limit on the maximum number of pixels in JPEG images processed by the NGINX JPEG filter module.

Syntaxjpeg_filter_max_pixel number;
Default0
Contexthttp, server, location
Arguments1

Description

The jpeg_filter_max_pixel directive is used within the NGINX JPEG filter module to define a limit on the maximum number of pixels in the JPEG images that are subjected to filtering operations. By setting this value, administrators can optimize performance and resource consumption when processing images. This can be particularly useful for high-traffic sites that need to manage resources effectively while serving images that might vary significantly in size.

This directive accepts a single integer argument, which represents the maximum number of pixels allowed for images processed by the JPEG filter. If an image exceeds this pixel limit, it will be excluded from some processing features or may be processed as is, depending on the configuration of other directives like jpeg_filter_graceful. The default value of this directive is 0, which means that there is no limit enforced by default. In practice, administrators might set this value based on server capabilities or the typical size of images served on their website.

When jpeg_filter_max_pixel is set to a non-zero value, any JPEG image exceeding this limit may not undergo the specified JPEG filtering operations, allowing for better control of processing over large images that could otherwise drain server resources. It provides an excellent way to optimize image handling in high-demand environments, enabling responsive server performance while serving content effectively.

Config Example

http {
    jpeg_filter_max_pixel 1000000;
    server {
        location /images {
            jpeg_filter on;
        }
    }
}

Setting this to a very low value may prevent valid images from being processed, leading to unexpected results.

Ensure that this directive is appropriately set in relation to the image sizes you expect to handle.

← Back to all directives