Image Processing Presets
Overview
Image Processing allows Anycast CDN generate, cache, and deliver modified copies of your source images without your origin having to produce and store every variation itself. To get a modified image, the end-user needs to request the image through your CDN domain via the URL and add the preset query with required parameters.
Image Processing is powered by imgproxy processing server, performing the actual image transformations. Presets are a layer on top of imgproxy’s processing options: each preset maps a name you choose to one or more imgproxy processing functions and the parameters those functions require.
Request structure
Basic request format
https://<cdn-domain>/<image-path>?preset=<preset-name>&<preset-parameters>Request Components
Host: Your deployed server, domain, or IP.
Source URL: URL of the original image.
Processing Options: Preset parameters, passed as query-string key/value pairs separated by ampersands
&
Example request URL
https://cdn.example.com/images/product.jpg?preset=resizefill&width=800&height=600Processing Options Syntax
preset=resizefilltells the CDN which preset to apply.width=800sets the target width to 800.height=600sets the target height to 600.
What this preset does
This request returns a transformed version of product.jpg image so it completely fills an 800 × 600 area, while leaving the original image unchanged.
If the source image does not match that aspect ratio, the image is scaled and then cropped as needed so the output has the exact requested dimensions.
Available presets
More presets incoming soon!
The following image transformation presets are currently available in the user panel.
Preset | Purpose | Preset definition |
|---|---|---|
| Crops an image to a specific size and anchor position. |
|
| Resizes an image using a selected resize mode. |
|
| Resizes an image to fit within the requested dimensions. |
|
| Resizes and crops an image to fill the requested dimensions. |
|
To access image processing configurations, open your resource and navigate to the Locations tab, click Image Processing to enable the parameter; the configuration page will unfold as shown below.
[Screenshot placeholder] Image Processing configuration in the user panel (Locations tab → Image Processing, default presets).
The $arg_ values are placeholders. When making a request, use the parameter name without $arg_ in the URL.
For instance:
$arg_widthneeds to becomewidth=600$arg_heightneeds to becomeheight=800$arg_gravityneeds to becomegravity=ce
Assume your source image is photo.jpg located here https://cdn.example.com/images/photo.jpg
Let’s see the application below:
Presets application
crop
Preset definition:
crop:$arg_width:$arg_height:$arg_gravityUtilization example:
https://cdn.example.com/images/profile.jpg?preset=crop&width=400&height=400&gravity=ceThis preset returns a 400 × 400 crop that is centered on the image.
What each query parameter does
preset=cropselects the crop preset.width=400sets the output image width.height=400sets the output image height.gravity=cekeeps the center of the image visible when cropping.
Result:
The image is cropped to a 400 × 400 square. The crop is centered on the source image.
crop parameters
width - sets output width in pixels.
height - sets output height in pixels.
gravity - sets the area of the image used as the crop anchor, remaining visible upon cropping.
gravity values
If left undefined, default gravity value defaults to ce.
Value | Position |
|---|---|
(empty) | Center |
| Center |
| Top |
| Bottom |
| Right |
| Left |
| Top-right |
| Top-left |
| Bottom-right |
| Bottom-left |
resize
Preset definition:
resize:$arg_type:$arg_width:$arg_heightUtilization example:
https://cdn.example.com/images/photo.jpg?preset=resize&type=fill&width=1200&height=1000This request tells the CDN to resize photo.jpg using the mode passed in type — here, fill, so the image completely fills a 1200 × 1000 area.
What each query parameter does:
preset=resizeselects the preset that lets the user choose the resize mode.type=fillmeans “fill the target box completely.”width=1200sets the required output width.height=1000sets the required output height.
Result:
The final image will always be exactly 1200 × 1000.
If the original image does not have the same aspect ratio as the target box, the image is first scaled proportionally and then cropped as needed so that the output fully covers the target area. This means no empty space remains, but some parts of the original image may be cut off from the edges.
resize parameters
type - defines resize mode.
fit - preserves the full image while fitting it within the requested width and height without cropping.
fill - fills out the set area exactly by resizing and cropping the image to the set width and height.
width - sets output width in pixels.
height - sets output height in pixels.
resizefit
Preset definition:
resize:fit:$arg_width:$arg_heightUtilization example:
https://cdn.example.com/images/photo.jpg?preset=resizefit&width=800&height=600This request tells the CDN to resize photo.jpg so it fits within an 800 × 600 area while keeping the original aspect ratio.
What each query parameter does:
preset=resizefitselects the shorthand preset that always fits the image inside the target box.width=800sets the maximum output image width.height=600sets the maximum output image height.
Result:
The whole image remains visible. No cropping is performed.
If the original image doesn’t match the 800 × 600 frame, the output will be scaled to fit inside that box, so one dimension may end up smaller than the requested size.
Best for: responsive previews, galleries, logos, and any image that must stay fully visible and must not be cropped.
resizefill
Preset definition:
resize:fill:$arg_width:$arg_heightUtilization example:
https://cdn.example.com/images/photo.jpg?preset=resizefill&width=1200&height=1000This request tells the CDN to resize photo.jpg so it completely fills a 1200 × 1000 area.
What each query parameter does:
preset=resizefillselects the shorthand preset that fills the target box completely.width=1200sets the required output width.height=1000sets the required output height.
Result:
You get the image with exact defined dimensions.
Best for: Website banners, thumbnails, product-card images, preview images, and fixed-size UI components.
Single-dimension resize
For resize presets, you can provide only width or height, leaving out the other dimension. If one dimension is omitted, the imgproxy calculates it automatically from the source image’s aspect ratio and the dimension you provided.
For example:
https://cdn.example.com/images/photo.jpg?preset=resizefit&height=600The output is 600 px high; its width is calculated automatically.
https://cdn.example.com/images/photo.jpg?preset=resizefit&width=800The output will be 800 px wide; its height is calculated automatically by preserving the original aspect ratio.
Same goes for fit and fill modes.