Image Format Converter avatar

Image Format Converter

Pricing

from $0.80 / 1,000 record scrapeds

Go to Apify Store
Image Format Converter

Image Format Converter

Converts images between PNG, JPEG, WEBP, and AVIF, with optional resize, aspect-ratio fit, and quality control. Accepts image URLs or inline data: URIs; returns one record per image with the converted file's download link and dimensions.

Pricing

from $0.80 / 1,000 record scrapeds

Rating

0.0

(0)

Developer

BowTiedRaccoon

BowTiedRaccoon

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

6 days ago

Last modified

Share

Convert images between PNG, JPEG, WEBP, and AVIF, with optional resize, aspect-ratio fit, and quality control. Point it at image URLs or inline data: URIs and get back one record per image with the converted file's download link and dimensions.


What this actor does

For each image in your input list, the actor:

  1. Fetches or decodes the source — a plain http(s) URL is downloaded; a data: URI (e.g. data:image/png;base64,...) is decoded inline, no network round-trip needed
  2. Optionally resizes it to the width/height you specify, using the fit mode you choose
  3. Re-encodes it to your target format at the quality level you choose
  4. Saves the converted file to the run's key-value store and returns a public download link

Every attempted image gets exactly one output record, whether the conversion succeeded or not — a bad URL or an unreadable file shows up as a record with status: "error" and a reason, not a crashed run.

Scope note: SVG is accepted as a source image (it's rasterized before conversion) but is not offered as a target format — turning a raster photo into a true vector SVG needs a tracing algorithm, not a format re-encode, and that isn't what this actor does.


Input

FieldTypeDefaultDescription
imagesarray of strings—Required. Image sources to convert, one result record per entry. Each is either a direct http(s) URL or an inline data: URI
targetFormatstring (enum)webpRequired. Output format for every converted file: jpeg, png, webp, or avif
qualityinteger80Encode quality 1-100 for lossy formats (jpeg, webp, avif). Ignored for png, which is always lossless
resizeWidthinteger—Target width in pixels. Leave blank to keep the source width (or derive it from resizeHeight, preserving aspect ratio)
resizeHeightinteger—Target height in pixels. Leave blank to keep the source height (or derive it from resizeWidth, preserving aspect ratio)
fitstring (enum)insideHow to fit the image when both resizeWidth and resizeHeight are set: inside, outside, cover, contain, or fill. Ignored when only one dimension (or neither) is set
smartCropbooleanfalseWhen fit is cover, crop toward the most visually significant region instead of the image center
maxItemsinteger5Maximum number of images to convert in this run (one record per image, in input order)

Example input:

{
"images": [
"https://example.com/photo.jpg",
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
],
"targetFormat": "webp",
"quality": 80,
"resizeWidth": 800,
"resizeHeight": 800,
"fit": "inside"
}

Output

One record per input image, always — success and failure alike.

FieldTypeDescription
sourceIndexintegerPosition of this image in your images array
sourcestringThe input URL (a data: URI is shown as the literal string "[data URI]")
statusstringok or error
errorMsgstringWhy the conversion failed; null on success
originalFormatstringDetected source image format (e.g. png, jpeg); null on failure
originalWidthintegerSource image width in pixels; null on failure
originalHeightintegerSource image height in pixels; null on failure
originalSizeBytesintegerSource image size in bytes; null on failure
convertedFormatstringOutput format actually written (matches targetFormat); null on failure
convertedWidthintegerOutput image width in pixels after any resize; null on failure
convertedHeightintegerOutput image height in pixels after any resize; null on failure
convertedSizeBytesintegerOutput file size in bytes; null on failure
downloadUrlstringPublic URL to download the converted file from the run's key-value store; null on failure

Example output record:

{
"sourceIndex": 0,
"source": "https://example.com/photo.jpg",
"status": "ok",
"errorMsg": null,
"originalFormat": "jpeg",
"originalWidth": 2400,
"originalHeight": 1600,
"originalSizeBytes": 843210,
"convertedFormat": "webp",
"convertedWidth": 800,
"convertedHeight": 533,
"convertedSizeBytes": 61244,
"downloadUrl": "https://api.apify.com/v2/key-value-stores/<store-id>/records/converted-0000.webp"
}

Limits

Each source image is capped at 15 MB before decoding — comfortably above any ordinary photo or screenshot. A handful of conversions run in parallel per batch, so very large runs process steadily rather than all at once.


Use cases

  • Web/app asset pipelines: Batch-convert uploaded photos to WEBP/AVIF for smaller page weight
  • Thumbnail generation: Resize and re-encode a product catalog's images to a consistent size
  • Format normalization: Standardize a mixed PNG/JPEG/WEBP image set to one target format before downstream processing
  • Inline asset conversion: Convert a base64-embedded image straight from another tool's output without hosting it first