Images
Introduction
Image files are used across the web (e.g., <img>
, <picture>
) and in mobile/desktop apps.
You can use image tasks to:
- Convert images to different formats for broader compatibility (JPEG/PNG/WebP/AVIF)
- Compress images to save bandwidth
- Resize and crop for specific layouts/aspect ratios
- Add text and image overlays (watermarks, badges)
- Normalize orientation and strip metadata for privacy
Required props
As with all Tasks, you must provide:
- either a file_id or a url to use as the input file
- the kind of task to create
File ID
The file_id should be the unique ID of a file in your project’s Files collection.
e.g. "file_id": "file_abcdefgh1234"
URL
The url should be the URL of the image file to process.
This should be a publicly accessible or signed URL.
e.g. "url": "https://example.com/image.jpg"
Kind
For image tasks, this is always image.
e.g. "kind": "image"
Default settings
If you don’t specify any options, the default task will create a new image file with the following settings:
Setting | Default Value |
---|---|
Width | Same as input file |
Height | Same as input file |
Fit | fill (no aspect preservation) |
Position | center |
Background | Transparent if supported; else black #000000 |
Format | Same as input file |
Quality | 80 (where applicable) |
Overlays | None |
If you just want to normalize uploaded images for web delivery, this is a reasonable set of defaults. We automatically respect EXIF orientation and (by default) strip metadata for privacy.
Shared options
All tasks support the following (optional) props:
- filename
- folder
- ref
See the Tasks documentation for more information on these options.
Image options
Image tasks support a number of optional properties to control the output. You can set a custom width, height, fit, position, background, format, quality, and add overlay layers.
Width
The width of the output image in pixels or as a percentage of the input file.
If you pass a percentage, it’s relative to the input’s width.
Height
The height of the output image in pixels or as a percentage of the input file.
If you pass a percentage, it’s relative to the input’s height.
If only one of width or height is specified, the other will be calculated to maintain the original aspect ratio and fit will be ignored.
Fit
How the image should be scaled to fit the width and height.
Available fits are:
- fill (default) – stretch to the exact box (may distort)
- cover – scale to cover the box, preserving aspect ratio (may crop)
- contain – scale to fit inside the box, preserving aspect ratio (may letterbox)
Position
Used with fit: cover or fit: contain, positions the image within the output frame.
Available positions are:
center (default), top, bottom, left, right, top left, top right, bottom left, bottom right.
If only one of width or height is specified, position has no effect.
Background
Used with fit: contain to fill any extra space. Hex color (e.g. #20B075) or the word transparent (for formats that support alpha).
If not specified, background is transparent for alpha-capable outputs (PNG/WebP/AVIF), otherwise black #000000.
Format
The output format of the image.
Available formats: jpeg, png, webp, avif.
If omitted, we keep the source format where possible.
Quality
Relative quality setting (where applicable), between 1 and 100.
Default is 80, a good balance of quality and file size.
Metadata & Color (optional)
Useful flags for privacy and consistency:
Orientation & Transforms (optional)
Layers
Layers let you add text and image overlays to the output. The layers prop accepts an array of objects.
A full “Layers” guide with visual examples is coming soon. If you’d like an early preview, contact us.
Supported Inputs
Input files can be:
Property | Values |
---|---|
Image Formats | jpeg, png, webp, avif, gif (first frame), svg (rasterized) |
Limits
Output files can be:
- up to 4096px on the longest edge (adjust if your real limits differ)
- up to 16MP in total pixels (adjust if needed)
- up to 4TB in size (if applicable to your storage tier)
Update these to match your actual limits.
Example API Response
A representative response for an image media with multiple derived files and an intelligence artifact:
Guides
…are coming soon!
Footnotes
- When converting formats, we normalize color profiles to sRGB for consistent display across devices.
- Progressive JPEG improves perceived load on slow networks; enable with progressive: true.