- Original image
- Cropped image

Enable the crop feature
Crop is part of the paid Image Stack option. Image Stack also supports converting images to WebP or AVIF, resizing, and adjusting quality. To use Crop, activate Image Stack following the Enable Image Stack guide.Use crop
1. Open the website source code. 2. Find the strings with the URLs of the images to crop. 3. Add the query strings to the URLs of the images as follows:image.jpg is the image URL on the website. The Crop parameters section lists all available parameters.
4. Save the changes in the website source code.
After saving, the CDN delivers cropped images to users requesting the webpage.
Crop parameters
Crop cuts out a section of an original image for delivery to users. Append a query string to the image URL to specify the target area and its location.Crop an image by customizing its aspect ratio
Parameter:?crop=16:9
where:
16= the width component of the target aspect ratio9= the height component of the target aspect ratio



Crop an image at its center
Parameter:?crop=300,200
where:
300= the target width200= the target height


Crop from a specific location
To cut out a section from a specific location, add the target width and height parameters (?crop=(width),(height)) and then the location of the section. The location can be specified in four ways, described in the subsections below.
Specify a location with two offsets measured in pixels
Parameter:?crop=300,200,x100,y50
where:
300= the target width200= the target height100= the number of pixels to offset from the original left side50= the number of pixels to offset from the original top

crop=200,100), so the tool selects this area in the picture.

x107,y30). The tool drags the target area so that its upper-left corner is at this point.


Specify a location using two coordinates measured as a percentage of the original image
Parameter:?crop=300,200,x25p,y10p
where:
300= the target width200= the target height25= the percent of the original width to offset from the left side10= the percent of the original height to offset from the top

crop=200,100), so the tool selects this area in the picture.

x25p,y10p): offset 25% of the original width from the left side and 10% of the original height from the top. The tool drags the target area so that its upper-left corner is at this point.


Specify a location using the ratio of unwanted areas
Parameter:?crop=300,200,offset-x20,offset-y40
where:
300= the target width200= the target height20= the percent of the unwanted width that should be cropped from the left side40= the percent of the unwanted height that should be cropped from the top

crop=100,100). The tool selects the target area in the picture.

offset-x50). Accordingly, 50% of the unwanted area remains on the right.

offset-y81). Accordingly, 19% of the unwanted height remains at the bottom.


Specify a location using one offset measured in pixels and one coordinate measured as a percentage of the original image
The previous options can be combined to crop an original image from a specific place — set the horizontal coordinate in pixels and the percentage of unwanted vertical area, or vice versa. Examples of combined query parameters:?crop=width,height,x(x-axis value),offset-y(percentage of unwanted area to be cropped from the top)?crop=width,height,offset-x(percentage of unwanted area to be cropped from the left),y(y-axis value)?crop=width,height,x(percentage of original image width from the left),offset-y(percentage of unwanted area to be cropped from the top)
Check HTTP headers
Check the HTTP response headers to verify that the crop was applied. TheX-Img-Operations header lists all conversions performed. If the value includes crop, the image has been cropped.

X-Img-Operations does not include crop and the CDN returns the original uncropped image, check the img-skip-reason header. This explains why the conversion failed.

