crop operation extracts a region from a source image. You can define the region manually with pixel coordinates, or let the engine choose the best region automatically using gravity modes.
Parameters
Must be
"crop".Path to the source image.
Path for the cropped output file.
Manual crop rectangle. Either
rect or gravity is required.Smart crop mode. Either
rect or gravity is required. When using gravity, width and height are also required.| Value | Description |
|---|---|
center | Crop centered on the image |
focal_point | Crop centered on the coordinates set by focal_x / focal_y |
entropy | Crop the region with the highest brightness variance |
Horizontal focal point as a normalized value between
0.0 (left edge) and 1.0 (right edge). Used when gravity is focal_point.Vertical focal point as a normalized value between
0.0 (top edge) and 1.0 (bottom edge). Used when gravity is focal_point.Target output width in pixels. Required when using
gravity.Target output height in pixels. Required when using
gravity.Output format:
png, jpeg, webp, or avif.Encode quality for JPEG and WebP outputs. Range: 1–100.
When
true, the output file is also returned as a base64-encoded string in data_base64.Go client
Examples
- Manual crop
- Smart crop