openBGremover / Docs

Convert images

Convert a static image to JPEG, PNG, WebP, or AVIF.

POST /api/v1/convert-image

Request

Conversion requires a JSON body with image_data and a target format.

{
  "image_data": "<base64 image>",
  "format": "webp",
  "quality": 80,
  "lossless": false
}

Set Content-Type: application/json and authenticate with your API key. Use Accept: image/* for direct file output, or the default JSON response for base64 and metadata.

Choose a format

FormatTransparencyBehavior
jpeg or jpgFlattened onto whiteLossy RGB encoding
pngPreservedLossless encoding
webpPreservedLossy by default; optional lossless mode
avifPreservedLossy; usually the smallest file, slower to encode

jpg is an alias. Output metadata and content type use jpeg. Conversion may increase file size. Negative bytes_saved in the response means the result is larger than the input.

Encoding options

OptionAllowed valuesApplies toDefault
qualityInteger 1–100JPEG, WebP, and AVIF80 for JPEG and WebP, 60 for AVIF
losslessBooleanWebPfalse
compression_levelInteger 0–9PNG6

Omit untouched options. Explicit false and 0 are preserved; null is not a default sentinel. Options for a different output format return 400 before a credit is reserved.

PNG is lossless at every compression level. Higher levels change encoding effort and file size. In lossless WebP mode, quality controls compression effort. Lossless encoding cannot restore detail already lost in a JPEG.

The server picks one encoder per format and reports it as encoder in the metadata: MozJPEG for JPEG, libpng for PNG, libwebp for WebP, and libavif for AVIF. AVIF quality uses its own scale: 60 gives about the same fidelity as JPEG at 80, in a smaller file.

Image handling

Conversion applies EXIF orientation and omits EXIF and text metadata. RGB ICC profiles are preserved. CMYK and grayscale inputs convert to sRGB, using their embedded profile or a standard CMYK profile when none is embedded.

Inputs must be static JPEG, PNG, WebP, AVIF, or HEIC. HEIC is an input format only: convert it to any output format. Only the primary photo in a HEIC file is used; burst sequences are rejected, and depth maps and HDR gain maps are ignored. 10- and 12-bit HEIC and AVIF are converted to 8-bit. JPEG, PNG, and WebP inputs must be 8-bit. Animated inputs are rejected. See limits.

On this page