The Crop transformation is a feature for cropping your images, allowing you to adjust the focus or dimensions according to your needs. This operation supports precise cuts with specific dimensions, as well as allowing the use of coordinates or predefined positions for more refined control.
Parameter structure
The URL to apply the Crop transformation should be structured as follows:
/crop:[width]x[height],[optional arguments]/
/crop:500x200/
To set height and width.
/crop:540x120,position:entropy/
Defining the crop position where we have more color entropy in the image.
/crop:540x120,position:northeast/
Defining the crop position at the northeast of the image.
To apply the crop, the URL should be formatted as follows:
https://img.voidr.co/my_project/crop:500x200/fetch/:url
Where value is the width and height in pixels, and optionally a position setting.
Optional arguments
⚠️ This transformer accepts optional arguments, if not specified, the default crop positioning is always attention
position
Defines the crop position, with predefined values available.- Positions using the gravity strategy available are:
north
,northeast
,southeast
,south
,southwest
,west
,northwest
,east
,center
entropy
Focuses on areas with higher entropy.attention
Focuses on areas with higher color saturation and presence of skin tones.
- Positions using the gravity strategy available are:
To crop an image to dimensions of 920x470 pixels in areas with higher saturation, the URL should be structured as follows:
https://img.voidr.co/my_project/crop:920x470,position:attention/fetch/:url
Usage example
To crop an image to dimensions of 3000x3000 pixels with the default attention crop positioning, the URL would be:
https://img.voidr.co/my_project/crop:3000x3000/fetch/https://images.unsplash.com/photo-1561336313-0bd5e0b27ec8
![](https://files.readme.io/81625be-3000x3000default.jpeg)
To crop an image to dimensions of 2400x1400 pixels, and focusing on areas with higher color entropy, the URL would be:
https://img.voidr.co/my_project/crop:2400x1400,position:entropy/fetch/https://images.unsplash.com/photo-1561336313-0bd5e0b27ec8
![](https://files.readme.io/1f4b063-entropy.jpeg)
To crop an image to dimensions of 2400x1400
pixels, from the northeast
position, the URL would be:
https://img.voidr.co/my_project/crop:2400x1400,position:northeast/fetch/https://images.unsplash.com/photo-1561336313-0bd5e0b27ec8
![](https://files.readme.io/50bd863-northeast.jpeg)
To crop an image to dimensions of 4400x2400
pixels, from the south
position, the URL would be:
https://img.voidr.co/my_project/crop:4400x2400,position:south/fetch/https://images.unsplash.com/photo-1561336313-0bd5e0b27ec8
![](https://files.readme.io/f1078a2-south.jpeg)