xtract.bot
POST /api/image-jpeg-to-png

Convert a JPEG image to PNG. Lossless re-encode of the decoded pixels — the JPEG itself is still lossy upstream, but no further loss is introduced.

Reads a JPEG and returns the same picture as a PNG. The PNG is losslessly compressed, so no further information is lost (the JPEG itself is still lossy upstream — there is no way to recover what JPEG's DCT quantisation discarded). Use this when you need a transparency-capable, alpha-channel (or just lossless) version of an existing JPEG: web assets, design composites, OCR inputs.

Inputs

NameTypeDefaultDescription
image*fileJPEG bytes.

Response

Modes: binary, json. Cache: yes (24h TTL).

Code samples

Built from the thumbnail example.

# Download or substitute the example input:
#   curl -O https://xtract.bot/examples/image-resize-jpeg/sample.jpg
IMAGE=$(base64 -w0 < sample.jpg)

curl -X POST https://api.xtract.bot/api/image-jpeg-to-png \
  -H "Content-Type: application/json" \
  -H "Accept: application/octet-stream" \
  -H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
  -H "X-Api-Key: $XTRACT_API_KEY" \
  -d '{
  "image": "'"$IMAGE"'"
}'