§ Transform
Resize Image API
Decodes straight to the target size where it can, so a 4,000px JPEG never fully materialises on its way to 400px. At least one of width or height is required, and only `inside` can scale by one side.
- Endpoint
- POST /image/resize
- 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/resize
curl -sS --fail-with-body \
-o thumb.jpg \
-H "Authorization: Bearer $OHMYWRAP_KEY" \
-F "file=@photo.jpg" \
-F 'options={"width":400,"height":400,"fit":"cover","position":"attention"}' \
https://api.ohmywrap.com/image/resizeOptions
| Option | Type | Default | What it does |
|---|---|---|---|
| width | int | — | At least one of width or height is required. |
| height | int | — | At least one of width or height is required. |
| fit | string | inside | `inside` `cover` `contain` `fill` `outside`. |
| position | string | centre | Crop anchor for `cover`: a compass point, or `attention` / `entropy`. |
| background | string | transparent | Letterbox colour for `contain`. #RGB, #RRGGBB, or #RRGGBBAA. |
| withoutEnlargement | bool | true | Refuse to upscale past the source size. |
| kernel | string | lanczos3 | `nearest` `linear` `cubic` `mitchell` `lanczos2` `lanczos3`. |
| 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
`fit` defaults to `inside`, not sharp’s `cover`. `inside` fits within the box and crops nothing; `cover` fills it and discards the overflow. If you are porting from sharp, pass `fit` explicitly. Setting `kernel`, or `autoOrient: false`, gives up the shrink-on-load fast path and forces a full decode.
Your first /image/resize 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.