Image Resize & Convert API

Resize, crop, rotate, flip and convert images between PNG and JPEG with high-quality resampling and adjustable JPEG quality to shrink file size.

POSThttps://apibox.io.vn/v1/image-resize
Images & Codes▶ Try it online

The image resize API transforms an uploaded PNG or JPEG. Set width and / or height (the other side keeps the aspect ratio) and a fit: inside (default, fits in the box), cover (fills the box and crops the centre, ideal for thumbnails), contain (fits and pads with a background colour) or fill (stretches). crop=x,y,width,height cuts a region first, rotate (90, 180, 270) and flip (horizontal, vertical) fix orientation, and no_enlarge=true never upscales.

Shrinking uses area averaging, which keeps fine details sharp without aliasing; enlarging uses bilinear interpolation. Output format=jpeg with quality (1–100, default 82) to reduce size; transparent areas are flattened on the background colour. Headers report the new size and the input / output byte counts.

Images up to 25 megapixels and the file size of your plan are accepted; everything runs in memory and nothing is stored.

Parameters

NameInTypeRequiredDefault
filebodyfileyesPNG or JPEG (multipart, raw body or file_base64).
widthquery|bodynumbernoTarget width (px).
heightquery|bodynumbernoTarget height (px).
fitquery|bodystringnoinsideinside, cover, contain, fill.
cropquery|bodystringnox,y,width,height before resizing.
rotatequery|bodynumberno90, 180 or 270.
flipquery|bodystringnohorizontal or vertical.
formatquery|bodystringnopng or jpeg (default: same as input).
qualityquery|bodynumberno82JPEG quality 1–100.
backgroundquery|bodystringnoffffffPadding / flatten colour.

Example

curl -X POST "https://apibox.io.vn/v1/image-resize?width=400&height=400&fit=cover&format=jpeg" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "0=@./my-file" \
  -o output

Response

binary image/jpeg

Use cases

  • Thumbnails and avatars from user uploads
  • Shrink photos before storing them
  • Convert PNG screenshots to lighter JPEG
  • Square images for marketplaces and social networks

FAQ

Is EXIF orientation applied?

Not automatically; use rotate= when a photo appears sideways (image-metadata tells you the EXIF orientation).

Is WebP supported?

Not yet: PNG and JPEG in and out.

What is the size limit?

25 megapixels and the file size of your plan (5–50 MB).

Related APIs

Start with 1,000 free requests every month. Get free API key →