Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Crop operation which removes faces from the top of the image
Crops out the topmost part of an image if it contains a face.
To control the margin when cropping the face out, you can use the face_margin=Y operation where Y is a percentage of the face height. Its default value is 20. You can also use negative numbers if you would like to keep part of the face.
func=facehide
Preview | Syntax |
---|---|
Crop operation focusing only on one face
Finds the most prominent face in the image and crops it to specified dimension provided with the width and height parameters. If you however provide only one dimension, the other dimension will be chosen automatically to keep the aspect ratio of the face.
func=face
If there is no face in the image or many faces are found, the operation defaults to a standard crop.
Preview | Syntax |
---|---|
Sets margins around the face. You can set equal margins with face_margin=X or separate horizontal and vertical margins (face_margin=W,H).
face_margin=X|W,H
Preview | Syntax |
---|---|
Resize and crop to achieve the desired width and height
Crops the image to specified dimensions (width and height) while keeping proportions and delivers the resulting image via CDN.
func=crop
This is the default resizing mode when both width and height operations are used. You do not need to specify func=crop explicitly.
Preview | Syntax |
---|---|
Specifies which part of the image you wish to keep while cropping. If you omit the gravity option, central cropping is performed.
gravity=X
Chooses the most important image features and objects and sets the focal point on them when cropping.
gravity=smart
gravity=auto
gravity=face
Sets the crop focal point on the people in the image or on the most prominent featues if no faces are detected. Useful for creating thumbnails from images with different aspect ratios.
Preview | Syntax |
---|
If you prefer to use the legacy automatic crop, just set gravity operation to auto.
Preview | Syntax |
---|
When using gravity=face, all images with one dominant face are focused on this face upon cropping. If there are many or no faces in the image, gravity falls back to auto.
If you would like to try and include multiple faces in the image, you can use gravity=smart
Setting crop gravity with focal point coordinates
Allows to crop an image by defining the coordinates of the crop focal point. It is useful when you want to crop images where the coordinates of the point of interest are already known.
To set the coordinates of the focal point, use the gravity=X,Y operation where X and Y are the coordinates of the focal point (in pixels). Alternatively, you can set the coordinates as a percentage of the original image - gravity=Xp,Yp or gravity=xc,yc, where X,Y=0..100 and x,y=0..1.
gravity=X,Y
gravity=Xp,Yp|xc,yc
Original image:
Please note that the focal point in gravity=X,Y has to be defined as coordinates X and Y of the full-sized origin image and not the scaled-down version.
Preview | Syntax |
---|---|
Preview | Syntax |
---|
Preview | Syntax |
---|
northwest
north
northeast
west
center | centre (default)
east
southwest
south
southeast
auto - more info
face - more info
smart - more info
X,Y - more info
Standard crop: /docs/business-portfolio.jpg?w=400&h=300
Face crop: /docs/classroom.jpg?h=240&w=380&func=face
Face crop with automatic aspect ratio: /docs/classroom.jpg?h=240&func=face
Crop by boundary coordinates
Allows to crop an image by providing the cropping area. It is useful when you want to crop a specific part of the image. To set the coordinates of the crop rectangle, use the tl_px and br_px operations.
tl_px=X1,Y1
br_px=X2,Y2
Original image: /docs/kids.jpg
Positionable crop can be combined with all available resize functions - width/height, crop, fit, bound or cover. This operation is performed after the positionable crop.
Crop by aspect ratio or aspect ratio range.
Sets target aspect ratio or aspect ratio range when cropping. Aspect ratios can be set as decimal values (1.778) or ratios (16:9).
aspect_ratio=AR | ar=AR
aspect_ratio=AR1,AR2 | ar=AR1,AR2
If you provide only one dimension parameter (width or height) and aspect_ratio, the other dimension will be calcualted. If you include both width and height in the URL, aspect_ratio is ignored.
If you provide only aspect_ratio and no dimensions (width or height), the image will be cropped without resizing.
Preview | Syntax |
---|---|
You can spcify a range of aspect ratio, for example aspect_ratio=4:3,16:9. Images which fall within this range, will not be cropped. Useful to avoid very wide ot very tall images by cropping them to the closest aspect ratio.
Preview | Syntax |
---|---|
Preview | Syntax |
---|---|
Original aspect ratio (3:2 or 1.5): /docs/car1.jpg?w=400
Cropped to 1.8: /docs/car1.jpg?w=400&aspect_ratio=1.8
Original aspect ratio (1.323): /docs/frog.png
Cropped to 3:2 (1.5): /docs/frog.png?aspect_ratio=3:2
Original aspect ratio 1.5: /docs/car1.jpg?w=400
Aspect ratio range 1.5..2 (no crop needed): /docs/car1.jpg?w=400&aspect_ratio=1.5,2.0
Original aspect ratio 2.25:1 (2.25): /docs/kids.jpg?w=400
Aspect ratio range 3:2..2:1 (1.5..2): /docs/kids.jpg?w=400&aspect_ratio=3:2,2:1