Chained pipelines pro
Though imgproxy's processing pipeline is suitable for most cases, sometimes it's handy to run multiple chained pipelines with different options.
imgproxy Pro allows you to start a new pipeline by inserting a section with a minus sign (
-) to the URL path:
^ the new pipeline starts here
Example 1: Multiple watermarks
If you need to place multiple watermarks on the same image, you can use chained pipelines for that:
In this example, the first pipeline resizes the image and places the first watermark, and the second pipeline places the second watermark.
Example 2: Fast trim
trim operation is pretty heavy as it involves loading the entire image into memory from the very start of processing. However, if you're going to scale down your image and trim accuracy is not very important to you, it's better to move trimming to a separate pipeline.
In this example, the first pipeline resizes the image, and the second pipeline trims the result. Since the result of the first pipeline is already resized and loaded to the memory, trimming will be done much faster.
Using with presets
You can use presets in your chained pipelines, and you can use chained pipelines in your presets. However, the behaior may be not obvious. The rules are the following:
- A preset is applied to the pipeline where is was used.
- A preset may contain a chained pipeline, and will be chained to the pipeline where the preset was used.
- Chained pipelines from the preset and from the URL are merged.
If we have the following preset:
And the following URL:
The result will look like this: