* Update landing page / README.md * Update GETTING_STARTED.md * Update installation.md * Update getting_the_image_info.md * update signing_the_url.md * Update watermark.md * Update presets.md * Update object_detection.md * Update autoquality.md * Update serving_local_files.md * Update docs/serving_files_from_s3.md * Update configuration.md * Update generating_the_url.md * Update chained_pipelines.md but chained pipelines section is not finished * Update serving_files_from_google_cloud_storage.md * Update new_relic.md * Update prometheus.md * Update datadog.md * Update image_formats_support.md * Update about_processing_pipeline.md * Update healthcheck.md * Update memory_usage_tweaks.md * Remove GIF/ICO/BMP/HEIF/AVIF support sections from docs/image_formats_support.md * Minor fixes of the docs * Update serving_files_from_azure_blob_storage.md * Fix issue with x and y offset for 're' watermark property * Fix params description in docs/watermark.md * Fix Alexander Madyankin GH name * Special thanks to Travis * Fix README Co-authored-by: DarthSim <darthsim@gmail.com>
2.4 KiB
Watermark
imgproxy supports the watermarking of processed images using another image.
Specifying watermark image
There are three ways to specify a watermark image using environment variables:
IMGPROXY_WATERMARK_PATH
: the path to the locally stored imageIMGPROXY_WATERMARK_URL
: the watermark image URLIMGPROXY_WATERMARK_DATA
: Base64-encoded image data. You can easily calculate it with the following snippet:base64 tmp/watermark.webp | tr -d '\n'`.
You can also specify the base opacity of a watermark using IMGPROXY_WATERMARK_OPACITY
.
📝Note: If you're going to use the scale
argument of watermark
, it's highly recommended to use SVG, WebP or JPEG watermarks since these formats support scale-on-load.
Watermarking an image
Use the watermark
processing option to put a watermark on a processed image:
watermark:%opacity:%position:%x_offset:%y_offset:%scale
wm:%opacity:%position:%x_offset:%y_offset:%scale
The available arguments are:
opacity
- watermark opacity modifier. The final opacity is calculated asbase_opacity * opacity
.position
- (optional) specifies the position of the watermark. Available values:ce
: (default) centerno
: north (top edge)so
: south (bottom edge)ea
: east (right edge)we
: west (left edge)noea
: north-east (top-right corner)nowe
: north-west (top-left corner)soea
: south-east (bottom-right corner)sowe
: south-west (bottom-left corner)re
: repeat and tile the watermark to fill the entire image
x_offset
,y_offset
- (optional) specify watermark offset by X and Y axes. When usingre
position, these values define the spacing between the tiles.scale
- (optional) a floating point number that defines the watermark size relative to the resulting image size. When set to0
or omitted, the watermark size won't be changed.
Custom watermarks :id=custom-watermarks
You can use a custom watermark by specifying its URL with the watermark_url
processing option:
watermark_url:%url
wmu:%url
The value of url
should be the Base64-encoded URL of the custom watermark.
By default, imgproxy caches 256 custom watermarks with an adaptive replacement cache (ARC). You can change the cache size using the IMGPROXY_WATERMARKS_CACHE_SIZE
environment variable. When IMGPROXY_WATERMARKS_CACHE_SIZE
is set to 0
, the cache is disabled.