Free plan

Convert Image

Change a picture to another file type, like JPG, PNG or WebP
POST
/v1/images/convert
WebP
JPEG
JPEG 453 KBWebP 316 KB

About this tool

Changes pictures from one file type to another without changing how they look, for example PNG to WebP or TIFF to JPG. You choose the new type, and can also set the quality and whether to keep the hidden details (such as camera and date). If a file has several pages or frames, it uses the first one unless you pick others.
For example, you turn a photo that will not open on your computer into a JPG that opens anywhere.

How to use it

  1. Choose this tool.
  2. Add one or more pictures with Upload or drag and drop.
  3. Choose the file type you want.
  4. Set the quality if you wish, then press Generate.
  5. Download the converted pictures.

What you get back

You get a new file in the type you chose for each picture, ready to download.
GOOD TO KNOW
The conversion itself is lossless apart from the target format's own compression. Without `quality` the lossy formats use their defaults (JPEG 80). Transparent pixels become `background` (default white) in JPEG and BMP. A source's EXIF orientation is applied to the pixels unless metadata=keep.
TEST IT LIVE

Try Convert Image in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
Images
Plan
Free
Method
POST
Endpoint
/v1/images/convert
Tool ID
images.convert
Authentication
API key
Accepts
JPEG, PNG, WEBP, GIF, AVIF, TIFF +15 more
Background jobs
Yes
Usage group
Image
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/images/convert" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'images=@photo.jpg' \
  -F 'output_format=jpeg' \
  -F 'page=1' \
  -F 'quality=1'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.images.convert({
    "images": 'photo.jpg',
    "output_format": "jpeg",
    "page": 1,
    "quality": 1
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->images()->convert([
    'images' => 'photo.jpg',
    'output_format' => 'jpeg',
    'page' => 1,
    'quality' => 1,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Converts each uploaded image to `output_format` without changing its pixels: PNG to WebP, JPEG to AVIF, TIFF to JPEG, SVG to PNG, an animated GIF to an animated WebP, and so on. Quality, colour profile, pixel density and metadata (strip, keep, or set author/copyright/GPS/EXIF) are controlled with the shared output parameters. Multi-page sources (TIFF, animated GIF/WebP) convert their first page unless `page` or `pages` says otherwise.

Convert Image accepts JPEG, PNG, WEBP, GIF, AVIF, TIFF, SVG, SVGZ, BMP, ICO, APNG, PNM and 9 more. You can send several files in one request.

Convert Image is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/images/convert with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.