Convert image format
image_convertConvert images between PNG, JPEG, WebP, AVIF, GIF, and TIFF while reading common source formats, applying EXIF rotation, and handling transparency or SVG rasterization.
Instructions
Convert an image to PNG, JPEG, WebP, AVIF, GIF or TIFF. Reads JPEG, PNG, WebP, AVIF/HEIF, GIF (first frame), TIFF, SVG, BMP and ICO. Transparent areas are filled with background when writing JPEG (or always with flatten). EXIF rotation is applied. SVGs are rasterised at their own size (width/height or viewBox; 1024×1024 if neither), scripts never run. Images larger than 16384 px a side or 100 MP are scaled down to fit. Web version: https://s3eidat.github.io/image-convert/
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | Yes | The image: a local file path (absolute, or relative to the server's --root) or base64 data (raw or a data: URI). | |
| format | No | Output format. Default png (as on the website). | png |
| output | No | Where to write the result: a file path, or a folder ending in "/". Default: the server output folder (a temp folder unless --out-dir is set). | |
| flatten | No | Fill transparency with the background for every format, not only JPEG. | |
| quality | No | Quality 1-100 for JPEG / WebP / AVIF (ignored for PNG). Default 92, same as the website. | |
| background | No | Colour used for transparent areas when writing JPEG or when flatten is on. Default #ffffff. | #ffffff |
| returnBase64 | No | Also return the output as base64 in the result (only for small files). Default false. |