The crop parameter removes pixels from an image. When specifying a crop, the values always start with width followed by height (for example, crop=4:3 or crop=640,480 or crop=0.8,0.4). When cropping a region of interest from an image (a.k.a., "art direction"), the x and y parameters determine the position of the sub-region of the source image, whereas the offset-x and offset-y parameters move the horizontal or vertical offset of the crop. When specifying smart cropping, content-aware algorithms attempt to crop an image to a fixed aspect ratio while intelligently focusing on the most important visual content, including the detection of faces.
Crop image width and height by pixel or percentage value.
Crop image width and height by aspect ratio.
Smart crop width and height by aspect ratio using content-aware image cropping.
Crop a sub region of an image before cropping the image.
Offset the image content on its x or y axis (or both) before cropping the image.
The x and y or offset-x and offset-y parameters are optional.
The optional x and y or offset-x and offset-y parameters can be supplied in any order after the width and height.
If no x, y or offset-x,offset-y parameters are supplied the image is cropped form the center point.
The x parameter can be supplied without y and visa versa.
The offset-x parameter can be supplied without offset-y and visa versa.
When using aspect ratio cropping, the crop parameter must be used in conjunction with a width or height parameter (or both) in order to return the correct output image size. If no width or height are supplied the largest area of the requested aspect ratio will be returned based on the dimensions of the source image.
Pixel rounding is performed on all calculations in a decimal format (with as much accuracy as possible). The final value is then rounded down.