Skip to main content
Every operation returns a single JobResult object as one JSON line on stdout. On success, success is true and outputs contains one or more OutputFile objects. On failure, success is false and an error field is present instead — see Errors.

JobResult

success
boolean
required
true when the operation completed without error, false otherwise.
operation
string
required
The name of the operation that was executed, e.g. "resize" or "video_transcode".
outputs
OutputFile[]
required
Array of files produced by the operation. Most operations produce one file; resize and srcset produce one per requested width.
elapsed_ms
number
required
Wall-clock time taken by the operation in milliseconds, measured inside the Rust engine.
metadata
object
Optional JSON object containing operation-specific data. Present for quality, exif (with return_metadata: true), and placeholder (dominant color). null when the operation does not produce metadata.

OutputFile

Each element of the outputs array describes one file produced by the operation.
path
string
required
Absolute or relative path to the output file written to disk.
format
string
required
Image format of the output file. One of png, jpeg, webp, or avif.
width
number
required
Width of the output image in pixels.
height
number
required
Height of the output image in pixels.
size_bytes
number
required
File size in bytes.
data_base64
string
Base64-encoded image data. Only present when the job was submitted with "inline": true. See inline output.

Successful response example

{
  "success": true,
  "operation": "resize",
  "outputs": [
    {
      "path": "dist/photo-320.webp",
      "format": "webp",
      "width": 320,
      "height": 213,
      "size_bytes": 14200
    },
    {
      "path": "dist/photo-640.webp",
      "format": "webp",
      "width": 640,
      "height": 427,
      "size_bytes": 34100
    },
    {
      "path": "dist/photo-1024.webp",
      "format": "webp",
      "width": 1024,
      "height": 683,
      "size_bytes": 68900
    }
  ],
  "elapsed_ms": 74,
  "metadata": null
}

Inline output example

When "inline": true is set, data_base64 is populated on each OutputFile:
{
  "success": true,
  "operation": "resize",
  "outputs": [{
    "path": "out/320-image.png",
    "format": "png",
    "width": 320,
    "height": 240,
    "size_bytes": 12345,
    "data_base64": "iVBORw0KGgoAAAANSUhEUgAAAAE..."
  }],
  "elapsed_ms": 33,
  "metadata": null
}

Metadata responses

Some operations populate the metadata field with operation-specific data.

AutoQuality (quality)

When the quality operation runs its binary-search optimization, metadata reports the final result:
metadata.target_size
number
The target file size in bytes that was requested.
metadata.final_quality
number
The quality value (1–100) that the binary search converged on.
metadata.final_size
number
The actual file size in bytes of the output.
metadata.deviation_percent
number
How far the final size is from the target, as a percentage.
metadata.iterations
number
Number of binary search iterations performed.
metadata.converged
boolean
true if the result fell within the configured tolerance; false if the search exhausted max_iterations without converging.
{
  "success": true,
  "operation": "quality",
  "outputs": [{ "path": "out/photo.jpg", "format": "jpeg", "width": 1920, "height": 1280, "size_bytes": 48500 }],
  "elapsed_ms": 310,
  "metadata": {
    "target_size": 50000,
    "final_quality": 72,
    "final_size": 48500,
    "deviation_percent": 3.0,
    "iterations": 6,
    "converged": true
  }
}

EXIF extract (exif)

When exif_op is "extract" or return_metadata is true, metadata contains the EXIF tags read from the source image:
metadata.has_exif
boolean
true if the image contains an EXIF block; false if none was found.
metadata.make
string
Camera manufacturer, e.g. "Canon".
metadata.model
string
Camera model, e.g. "EOS 5D".
metadata.orientation
number
EXIF orientation value (1–8). 1 means no rotation needed.
metadata.datetime
string
Capture timestamp in EXIF format: "YYYY:MM:DD HH:MM:SS".
metadata.exposure_time
string
Shutter speed as a fraction, e.g. "1/250".
metadata.f_number
string
Aperture value, e.g. "f/2.8".
metadata.iso
number
ISO sensitivity, e.g. 400.
metadata.gps
object
GPS coordinates, if present.
{
  "success": true,
  "operation": "exif",
  "outputs": [],
  "elapsed_ms": 5,
  "metadata": {
    "has_exif": true,
    "make": "Canon",
    "model": "EOS 5D",
    "orientation": 1,
    "datetime": "2024:01:15 10:30:00",
    "exposure_time": "1/250",
    "f_number": "f/2.8",
    "iso": 400,
    "gps": {
      "latitude": 40.7128,
      "longitude": -74.0060,
      "altitude": 10.5
    }
  }
}

Build docs developers (and LLMs) love