Image Converter

Image Converter API

Design

Convert images between JPG, PNG, WebP, HEIC, GIF, BMP, AVIF, SVG, ICO and PDF in your browser, in bulk, with quality, background colour and resize options.

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

Convert an image to JPG, PNG, WebP, AVIF, GIF, BMP, ICO or PDF. Send the image as multipart form data in the file field. The response body is the converted file, named after the upload with the new extension.

Output formats

  • jpg, webp, avif: lossy, using quality. JPG has no transparency, so transparent areas get the background colour.
  • png: lossless, keeps transparency.
  • gif: one frame, up to 256 colours.
  • bmp: uncompressed 24-bit bitmap; transparency is filled with background.
  • ico: 16, 32, 48 and 256 px icons in one file (small images skip sizes over twice their size). maxWidth and maxHeight are ignored.
  • pdf: one page sized to the picture, stored as a JPG at quality.

Notes

  • Accepted input: JPEG, PNG, WebP, GIF (first frame), AVIF, TIFF and SVG, up to 20 MB and 50 megapixels. BMP, ICO and HEIC input are not supported by the API (the web page can read them in your browser) and return 415.
  • maxWidth and maxHeight fit the image inside a box, keeping its shape. Raster images are never enlarged; SVGs are drawn at the size that fills the box. The output can be at most 10000 pixels per side.
  • The EXIF orientation is applied, and metadata such as GPS and camera details is removed.

Endpoints

POST
https://opentools.ca/api/v1/tools/image-converter
Convert an image to another format

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.
to
string
Enum: jpg, png, webp, avif, gif, bmp, ico, pdf
OptionalOutput format.Default: jpg
quality
number
OptionalQuality from 30 to 100, for jpg, webp, avif and pdf.Default: 85
background
string
OptionalHex colour (#rrggbb) that fills transparent areas in jpg, bmp and pdf.Default: #ffffff
maxWidth
number
OptionalMaximum width in pixels, 1 to 10000. Blank means no limit.
maxHeight
number
OptionalMaximum height in pixels, 1 to 10000. Blank means no limit.

Response Example

HTTP/1.1 200 OK
Content-Type: image/png
Content-Disposition: attachment; filename="holiday.png"

<binary file data>

Error Codes

400
Bad Request - Missing file, invalid option, or output over 10000 pixels per side
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-converter \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@holiday.webp" \
  -F "to=jpg" \
  -F "quality=90" \
  -F "maxWidth=2000" \
  -o holiday.jpg

Ready to get started?

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

Rather use it in your browser? Open the Image Converter