image_filter_jpeg_quality

Sets the JPEG image quality for image processing in NGINX.

Syntaximage_filter_jpeg_quality number;
Default75
Contexthttp, server, location
Arguments1

Description

The image_filter_jpeg_quality directive allows you to specify the quality of JPEG images when they are processed by the NGINX image filter module. It accepts a single argument that indicates the desired quality level, which ranges from 1 to 100. A lower number results in higher compression and lower image quality, while a higher number produces better image quality but larger file sizes.

When you set this directive within the http, server, or location context, NGINX will apply the specified quality setting to all JPEG images processed by the image filter. This is particularly useful for optimizing image delivery by balancing file size and visual fidelity, which can lead to improved loading times and bandwidth savings for web applications. It is important to note that this directive will only work if the image filter module is included and enabled in your NGINX configuration.

One special characteristic of the directive is that if you're serving images on a website that requires quick load times for users, you might want to experiment with the quality setting to find the best balance that satisfies both performance and appearance criteria. Additionally, changes to this directive will require a reload of NGINX configurations to take effect.

Config Example

http {
    location /images {
        image_filter jpeg;
        image_filter_jpeg_quality 85;
    }
}

Setting too low a quality value may lead to visibly poor images.

The directive only applies when the image filter module is used; ensure it is enabled.

Changes to this directive require reloading the NGINX configuration.

← Back to all directives