Image Editor - Instructions
Overview
The Image Editor tool provides programmatic image manipulation capabilities including resizing, cropping, rotating, drawing shapes, adding text, compositing layers, applying blur effects, adding borders, creating transparent regions, inverting colors, and more. Operations can be chained together using multi_step mode.
Image Input
Every action (except create) requires an image input via one of:
- image_url - Public URL to a PNG, JPG, or WebP image
- image_base64 - Base64-encoded image data
- file_id - File ID from cloud storage (from a previous upload or edit)
Common Output Options
| Parameter | Type | Default | Description |
|---|---|---|---|
| output_format | string | "png" | Output format: png, jpeg, or webp |
| filename | string | "edited.<ext>" | Filename for the stored output |
| store_file | boolean | true | Store the result in cloud storage (returns file_id and signed_url) |
| return_base64 | boolean | false | Also return the image as inline base64 (max 10 MB) |
Actions
info
Get image dimensions and mode without modifying it.
Required: An image input (image_url, image_base64, or file_id) Optional params: None
Example:
{
"action": "info",
"image_url": "https://example.com/photo.png"
}
create
Create a new blank image canvas.
Required: None (defaults apply) Optional params:
| Param | Type | Default | Description |
|---|---|---|---|
| width | integer | 512 | Canvas width in pixels |
| height | integer | 512 | Canvas height in pixels |
| color | string/array | "#ffffff" | Fill color (hex string, RGB array, or RGBA array) |
Example:
{
"action": "create",
"params": { "width": 800, "height": 600, "color": "#ff0000" }
}
resize
Resize an image to specific dimensions or by a scale factor.
Required: An image input + either width/height or scale in params
Optional params:
| Param | Type | Description |
|---|---|---|
| width | integer | Target width in pixels |
| height | integer | Target height in pixels |
| scale | float | Scale factor (e.g., 0.5 for half size, 2.0 for double) |
Example (explicit dimensions):
{
"action": "resize",
"image_url": "https://example.com/photo.png",
"params": { "width": 256, "height": 256 }
}
Example (scale factor):
{
"action": "resize",
"file_id": "abc123",
"params": { "scale": 0.5 }
}
crop
Crop an image to a rectangular region.
Required: An image input + box in params
Optional params: None beyond the required box
| Param | Type | Description |
|---|---|---|
| box | array of 4 ints | Crop region as [left, top, right, bottom] in pixels |
Example:
{
"action": "crop",
"image_url": "https://example.com/photo.png",
"params": { "box": [50, 50, 300, 300] }
}
rotate
Rotate an image by a specified number of degrees.
Required: An image input Optional params:
| Param | Type | Default | Description |
|---|---|---|---|
| degrees | float | 0 | Rotation angle in degrees (counter-clockwise) |
| expand | boolean | true | Expand canvas to fit rotated image |
Example:
{
"action": "rotate",
"image_url": "https://example.com/photo.png",
"params": { "degrees": 90 }
}
blur
Apply Gaussian blur to an image.
Required: An image input Optional params:
| Param | Type | Default | Description |
|---|---|---|---|
| radius | float | 2.0 | Blur radius (higher = more blur) |
Example:
{
"action": "blur",
"file_id": "abc123",
"params": { "radius": 5.0 }
}
border
Add a solid-color border around an image.
Required: An image input Optional params:
| Param | Type | Default | Description |
|---|---|---|---|
| size | integer | 10 | Border width in pixels |
| color | string/array | "#000000" | Border color |
Example:
{
"action": "border",
"image_url": "https://example.com/photo.png",
"params": { "size": 20, "color": "#0000ff" }
}
invert
Invert all colors in an image, producing a photographic negative effect. Each RGB pixel value is replaced with 255 minus its original value. Alpha transparency is preserved on RGBA images.
Required: An image input (image_url, image_base64, or file_id) Optional params: None
Example:
{
"action": "invert",
"image_url": "https://example.com/photo.png"
}
Example (with file_id):
{
"action": "invert",
"file_id": "abc123",
"output_format": "png",
"store_file": true
}
text
Draw text onto an image.
Required: An image input + text in params
Optional params:
| Param | Type | Default | Description |
|---|---|---|---|
| text | string | (required) | The text to draw |
| x | integer | 0 | X position in pixels |
| y | integer | 0 | Y position in pixels |
| size | integer | 20 | Font size |
| color | string/array | "#000000" | Text color |
Example:
{
"action": "text",
"image_url": "https://example.com/photo.png",
"params": { "text": "Hello World", "x": 50, "y": 100, "size": 36, "color": "#ffffff" }
}
draw
Draw shapes (line, rectangle, or ellipse) onto an image.
Required: An image input + coordinates in params
Optional params:
| Param | Type | Default | Description |
|---|---|---|---|
| shape | string | "line" | Shape type: line, rectangle, or ellipse |
| coordinates | array | (required) | Coordinate pairs (e.g., [x1, y1, x2, y2]) |
| fill | string/array | "#000000" | Fill color |
| outline | string/array | "#000000" | Outline color (rectangle and ellipse) |
| width | integer | 1 | Line/outline width in pixels |
Example (rectangle):
{
"action": "draw",
"image_url": "https://example.com/photo.png",
"params": {
"shape": "rectangle",
"coordinates": [10, 10, 200, 150],
"fill": "#ff000080",
"outline": "#ff0000",
"width": 3
}
}
composite
Overlay one image on top of another with optional opacity.
Required: An image input (the base) + an overlay image via one of: overlay_url, overlay_base64, or overlay_file_id in params
Optional params:
| Param | Type | Default | Description |
|---|---|---|---|
| overlay_url | string | — | URL of the overlay image |
| overlay_base64 | string | — | Base64-encoded overlay image |
| overlay_file_id | string | — | File ID of the overlay image |
| position | array | [0, 0] | [x, y] position to place the overlay |
| opacity | float | 1.0 | Overlay opacity (0.0 to 1.0) |
Example:
{
"action": "composite",
"image_url": "https://example.com/background.png",
"params": {
"overlay_url": "https://example.com/logo.png",
"position": [50, 50],
"opacity": 0.8
}
}
shear
Apply an affine shear transformation to an image.
Required: An image input Optional params:
| Param | Type | Default | Description |
|---|---|---|---|
| x | float | 0 | Horizontal shear factor |
| y | float | 0 | Vertical shear factor |
Example:
{
"action": "shear",
"image_url": "https://example.com/photo.png",
"params": { "x": 0.3, "y": 0.0 }
}
transparent
Make a specific color transparent in the image.
Required: An image input Optional params:
| Param | Type | Default | Description |
|---|---|---|---|
| color | string/array | "#ffffff" | The color to make transparent |
Example:
{
"action": "transparent",
"image_url": "https://example.com/icon.png",
"params": { "color": "#ffffff" },
"output_format": "png"
}
multi_step
Chain multiple operations together in a single request. Each operation is applied sequentially.
Required: An image input (or use a create operation first) + operations array
operations is an array of objects, each with:
| Field | Type | Description |
|---|---|---|
| action | string | Any single action listed above (not multi_step or info) |
| params | object | Parameters for that action |
Example:
{
"action": "multi_step",
"image_url": "https://example.com/photo.png",
"operations": [
{ "action": "resize", "params": { "width": 400, "height": 300 } },
{ "action": "invert", "params": {} },
{ "action": "border", "params": { "size": 5, "color": "#333333" } },
{ "action": "text", "params": { "text": "Inverted", "x": 10, "y": 10, "color": "#ffffff" } }
],
"output_format": "jpeg",
"filename": "processed.jpg"
}
Color Format
Colors can be specified as:
- Hex string:
"#RRGGBB"or"#RRGGBBAA" - RGB array:
[255, 0, 0] - RGBA array:
[255, 0, 0, 128] - Comma-separated string:
"255,0,0"or"255,0,0,128"
Common Workflows
- Resize and watermark: Use
multi_stepwithresizethentextto add a watermark label. - Create branded image: Use
createto make a canvas, thenmulti_stepwithcompositeto overlay a logo andtextfor copy. - Thumbnail generation: Use
resizewith ascalefactor or explicit small dimensions, output asjpegfor smaller file size. - Remove white background: Use
transparentwithcolor: "#ffffff"and output aspngto preserve transparency. - Annotate a screenshot: Use
multi_stepwithdraw(rectangles for highlights) andtext(labels). - Create dark mode variant: Use
invertto flip all colors, useful for generating negative versions of light-themed assets. - Accessibility contrast check: Use
invertto preview how content reads with reversed colors.
Important Notes
- Output is stored in cloud storage by default (store_file=true) and returns a
file_idandsigned_url. - Use
file_idfrom a previous result as input for follow-up edits. - The
infoaction returns dimensions and mode without producing an output image. - The
createaction does not require any image input. - For
multi_step, operations are applied in order; each step modifies the image from the previous step. - Inline base64 output (return_base64=true) is limited to 10 MB.
- Stored files expire after 7 days.







