jpeg_filter_dropon_file

The `jpeg_filter_dropon_file` directive overlays a specified image on top of JPEG images being processed by the NGINX JPEG filter module.

Syntaxjpeg_filter_dropon_file image [mask];
Defaultnone
Contextlocation
Arguments1-2

Description

The jpeg_filter_dropon_file directive allows users to define an overlay image that can be applied to JPEG images when they are served through NGINX. This feature is particularly useful for adding watermarks or logos to images on the fly without altering the original image files on the server. The directive accepts one or two arguments: the first is the path to the overlay image, and the optional second argument is a mask image that can control the transparency and blending effects of the overlay on the primary image.

To configure this directive, it must be placed within a location block, specifying the overlay image and, optionally, a mask. The overlay is applied using the libmodjpeg library during the image processing phase in NGINX. The directive facilitates various use cases, such as dynamically branding images for different users or purposes without needing to reprocess the JPEG files, thus enhancing flexibility and reducing overhead on the server.

When using the optional masking image, it serves to define the areas of the overlay that will be visible or modified, allowing for more sophisticated overlay effects. If only one image is provided, the overlay will be applied on that basis, potentially covering the entire JPEG image. If a mask is specified, it will determine the blend and coverage areas of the overlay, providing a more refined control over how the overlay is rendered on the original image.

Config Example

location /images/ {
    jpeg_filter on;
    jpeg_filter_dropon_file /path/to/overlay.png /path/to/mask.png;
}

Ensure the overlay and mask images are in a compatible format and dimensions with the original JPEG for proper blending.

Absolute paths should be provided to prevent file not found errors, especially in contexts where the working directory might differ.

The module may require specific permissions to read the overlay and mask image files; ensure proper file permissions are set.

← Back to all directives