Image Resizer

Image Resizer API

Web Development

Quickly resize images to exact dimensions for websites, social media, and marketing. Perfect for maintaining aspect ratios while optimizing for different platforms.

Authentication

All API requests require a valid API key passed in the Authorization header as a Bearer token.

Rate Limit

20 requests per minute

Endpoints

1 endpoint available

Overview

Resize an image to a width and height in pixels. The result keeps the input's format (SVG input is returned as PNG). Send the image as multipart form data in the file field. The response body is the resized image file.

Notes

  • Accepted input: JPEG, PNG, WebP, GIF, AVIF, TIFF and SVG, up to 20 MB and 50 megapixels. BMP, ICO and HEIC files return 415. Animated GIFs use the first frame.
  • With keepAspectRatio (the default), the box shrinks to the image's shape so nothing is stretched: a 4000 x 3000 photo sent with 800 x 800 comes back 800 x 600. Set it to false to fill the box exactly.
  • Images can be enlarged. Width and height can be at most 10000 pixels.
  • The EXIF orientation is applied first, and metadata is removed.

Endpoints

POST
https://opentools.ca/api/v1/tools/image-resizer
Resize an image to a width and height

Request Body

Content-Type: multipart/form-data

ParameterTypeRequiredDescription
file
file
Required
The image, up to 20 MB and 50 megapixels. JPEG, PNG, WebP, GIF (first frame), AVIF, TIFF or SVG.
width
number
Required
Target width in pixels, 1 to 10000.
height
number
Required
Target height in pixels, 1 to 10000.
keepAspectRatio
boolean
OptionalShrink the box to the image's aspect ratio instead of stretching. "true" or "false".Default: true

Response Example

HTTP/1.1 200 OK
Content-Type: image/jpeg
Content-Disposition: attachment; filename="photo-800x600.jpg"

<binary file data>

Error Codes

400
Bad Request - Missing file, width or height, or an invalid value
401
Unauthorized - Invalid or missing API key
403
Forbidden - API key is inactive or expired, or the request IP is not allowed
413
Payload Too Large - File over 20 MB or image over 50 megapixels
415
Unsupported Media Type - Not an image the server can read (BMP, ICO and HEIC are not supported)
429
Too Many Requests - Rate limit exceeded
500
Internal Server Error

Code Examples

curl -X POST https://opentools.ca/api/v1/tools/image-resizer \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@photo.jpg" \
  -F "width=800" \
  -F "height=800" \
  -F "keepAspectRatio=true" \
  -o photo-small.jpg

Ready to get started?

Create an API key to start using the Image Resizer API.

Rather use it in your browser? Open the Image Resizer