§ Transform
Crop Image API
Exactly one of three modes per request: an explicit rectangle, a smart crop to a size, or a trim that removes a uniform border. Mixing them is a 422 — a request carrying both a rectangle and a strategy has not decided what it wants.
- Endpoint
- POST /image/crop
- Inputs
- Exactly 1 image
- Returns
- The encoded image
- Limits
- 20 MB per file, 50 M pixels in, 50 M pixels out.
- Price
- $0.001
§ 01 The request
One POST, and the file comes back.
POST /image/crop
curl -sS --fail-with-body \
-o trimmed.png \
-H "Authorization: Bearer $OHMYWRAP_KEY" \
-F "file=@scan.png" \
-F 'options={"trim":{"threshold":15,"background":"#ffffff"}}' \
https://api.ohmywrap.com/image/cropOptions
| Option | Type | Default | What it does |
|---|---|---|---|
| left, top, width, height | int | — | Rectangle mode. All four, and inside the image. |
| strategy | string | — | Strategy mode, with width and height: `attention`, `entropy`, `centre`. |
| trim | object | — | Trim mode: {"threshold": 10, "background": "#ffffff"}. |
| autoOrient | bool | true | Apply the EXIF orientation before transforming. Turning it off costs the shrink-on-load fast path. |
| animated | bool | false | Process every frame of an animated GIF or WebP instead of flattening to the first. |
| output | object | — | The shared encode block: format, quality, lossless, effort, progressive, keepMetadata. |
Worth knowing
A rectangle that falls outside the image is 422 invalid_crop, and the error quotes the rectangle and the image size.
Your first /image/crop call takes one line of curl.
Ten thousand calls cost ten dollars, the pack never expires, and nothing you send is kept.
10,000 calls for $10. No subscription, no expiry.