ohmywrap
Get an API key

§ 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/resize

Options

Options accepted inside the options JSON object
OptionTypeDefaultWhat it does
widthintAt least one of width or height is required.
heightintAt least one of width or height is required.
fitstringinside`inside` `cover` `contain` `fill` `outside`.
positionstringcentreCrop anchor for `cover`: a compass point, or `attention` / `entropy`.
backgroundstringtransparentLetterbox colour for `contain`. #RGB, #RRGGBB, or #RRGGBBAA.
withoutEnlargementbooltrueRefuse to upscale past the source size.
kernelstringlanczos3`nearest` `linear` `cubic` `mitchell` `lanczos2` `lanczos3`.
autoOrientbooltrueApply the EXIF orientation before transforming. Turning it off costs the shrink-on-load fast path.
animatedboolfalseProcess every frame of an animated GIF or WebP instead of flattening to the first.
outputobjectThe 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.