Adjust a photo
photo_editAdd, change, switch off, reorder or remove the photo's adjustments; everyone watching sees each call land, and each call is one step in the replay (photo_undo takes it back). edits, in order:
{add: {op, name?, ...settings, mask?}, at?: n | "top" (default: applied last) | "bottom" | {before: name} | {after: name}}
{target: name or id, set: {...settings, mask?, name?}} (a setting set to null goes back to its default; mask: null removes the mask)
{target, on: false} switches it off without losing it; on: true brings it back
{target, order: as at}; {target, delete: true} Name each adjustment by what it does ("warm-up", "lift-face", "background-blur"). preview: "after" sends the new look back with the call. Choosing a mask (details below): a whole thing (a person, the sky, a car, an eye) is best found by photo_select (subject, sky, or object with a point on it), not guessed with shapes. An irregular area you can trace (a strand of hair, the top edge of fur, a path) is a stroke: {kind: "stroke", points: [[x, y], ...], width, feather}, a soft brush along the points (up to 2000). Parts of something by tone or colour: combine, e.g. {select: {id}, range: {by: "luma", from: 0.6, to: 1}} is the subject's bright parts. Before placing shapes on something small, zoom in with photo_look {view} to read its position, and after, zoom again (with adjustment: name to see the mask) to check the edge. To make something a given colour use colorize (exact colour, texture kept; amount 0.6 to 0.8 looks natural), not a hue rotation. Up to 30 edits a call, 60 adjustments a layer. Layers (bottom to top; the photo is always the bottom, always on, normal and opaque). Adjustments go on the photo unless layer names another: {add: {...}, layer: name}, {target, layer, set}.
{layer: {add: {kind, name?, on?, blend?, opacity?, mask?, ...}}, at?: n (1 is just above the photo) | "top" (default) | "bottom" | {before: name} | {after: name}}, where kind is: "adjust" (list?: adjustments applied to everything below; no crop, straighten or turn), "fill" (fill: {color: "#rrggbb"} or {gradient: "linear", x1, y1, x2, y2, stops: [[0, "#000000"], [1, "#ffffff"]]} or {gradient: "radial", cx, cy, r, stops}, or a texture drawn from a seed at any size: {texture: "scatter", count (1 to 5000), color?, size?: [smallest, largest] diameter as fractions of the long side, or one number for the largest (default [0.004, 0.012]), softness? 0..1 (0.6), vary? 0..1 (0.5, how much each dot's strength varies), seed?} for snow, rain spots, dust, bokeh or sparkles (transparent between the dots; blend "screen" for light), or {texture: "noise", scale (feature size, a fraction of the long side), octaves? 1..6 (4), stops? (as a gradient's, default black to white), seed?} for fog, mist, haze or grain (blend "screen" with a black first stop adds only light; mask it to where the fog lies)), "raster" (text and shapes, up to 60 ops: for snow, rain, dust or sparkles use a fill with texture "scatter" instead; content {ops: [...]}, the canvas's own ops (text, rect, circle, ellipse, line, polygon, path, stroke, group; canvas_schema describes them), in a space 1000 units on the picture's long side, the other side in proportion: photo_look says its size. Text uses the canvas's faces, e.g. {k: "text", x: 60, y: 120, text: "Summer", size: 72, font: "display", fill: "#ffffff"}), "photo" (another picture: photo_place adds one; src from one already placed can be used again, with box {x, y, w, h?, deg?}: fractions of the picture, h left out keeps its shape).
{layer: name, set: {name?, on?, blend?, opacity?, mask?, box?, fill?, content?}} (mask: null removes it; {target: name, set} works too when no adjustment has that name); {layer: name, on: false}; {layer: name, order: as at}; {layer: name, delete: true}. Blend modes: normal, multiply, screen, overlay, soft-light, hard-light, darken, lighten, color-dodge, color-burn, difference, exclusion, hue, saturation, color, luminosity. A layer's mask is in the picture's coordinates and reads the layers below it. Up to 12 layers and 4 photos on a canvas. Ops (settings, ranges, defaults): crop {x 0..1 =0, y 0..1 =0, w 0..1 =1, h 0..1 =1, ratio}: Keep a rectangle of the picture; later fractions refer to the kept part straighten {deg -45..45 (required)}: Turn about the centre (positive is clockwise), then keep the largest centred box of the same aspect with no empty corners; bilinear turn {quarter 0|90|180|270 =0, flip ""|"h"|"v"|"hv" =""}: Turn by quarter turns clockwise, then flip; exact pixel moves exposure {ev -4..4 (required)}: Linear light × 2^ev whiteBalance {temp -1..1 =0, tint -1..1 =0}: Channel gains in linear light: temp warms (+) or cools (−), tint adds magenta (+) or green (−); grey keeps its brightness contrast {amount -1..1 (required)}: An S-curve about mid-grey on encoded values (negative flattens) levels {black 0..254 =0, white 1..255 =255, gamma 0.1..10 =1}: Per channel: (v − black) / (white − black), then the power 1/gamma, on encoded values curves {rgb, r, g, b}: Monotone cubic (Fritsch–Carlson) through [in, out] points 0..255; a channel curve, then the rgb curve hueSat {hue -180..180 =0, sat 0..3 =1}: SVG feColorMatrix hueRotate × saturate, one 3×3 matrix on encoded values; turns every colour by the same angle, so to make something one given colour (blue eyes, a red shirt) use colorize colorize {color ="#3d7fd9", amount 0..1 =1}: Make it this colour: each pixel takes the colour's hue and saturation and keeps its own lightness (the "color" blend), so its texture and shading stay; for recolouring eyes, clothes or a wall, through a mask vibrance {amount -1..1 (required)}: Saturation scaled by 1 + amount·(1 − s)², s the pixel's own saturation: dull colours move most blur {sigma 0..0.05 =0.003, direction "both"|"horizontal"|"vertical"}: Separable Gaussian, radius ⌈3σ⌉, edges clamped at the picture's edge; direction "vertical" or "horizontal" blurs one way only, which smooths away lines across that way and keeps lines along it (a vertical blur removes a horizontal seam on vertically ribbed knit and keeps the ribs) smoothTone {sigma 0.0005..0.05 (required), detail 0.0002..0.02 =0.002, direction "both"|"horizontal"|"vertical"}: Smooth light and shade but keep texture (frequency separation): the picture is split into its shading (a blur of detail) and its fine detail (the rest); the shading is blurred by sigma (one way with direction) and the detail added back, so weave, pores and grain stay while blotches, lines and shadows across them even out. A seam sharper than detail stays in the detail: there a one-way blur is the better tool sharpen {sigma 0..0.01 =0.0005, amount 0..5 =0.5, threshold 0..255 =0}: Unsharp mask on luminance: L + amount·(L − blur(L)) where |L − blur(L)| passes the threshold vignette {strength -1..1 =0.3, midpoint 0..0.99 =0.5, roundness 0..1 =0}: Multiply by a smooth radial falloff, 1 inside the midpoint, 1 − strength at the corners grain {amount 0..1 =0.2, size 0.00005..0.01 =0.0003}: Luminance noise hashed from the position in the original photo, averaged over each pixel's footprint, so it lands the same at every size clone {from {x, y} 0..1 (required), to {x, y} 0..1 (required), r 0.001..0.25, shape, feather 0..0.25, opacity 0..1 =1}: Copy a soft-edged patch of the picture from one place to another, as a clone stamp does: a disc of radius r at to, or a shape (an ellipse at to, or a brush stroke along points: one call patches a whole seam), copied from the same offset from − to; bilinear. With a mask, only the masked pixels change heal {from {x, y} 0..1 (required), to {x, y} 0..1 (required), r 0.001..0.25, shape, feather 0..0.25, opacity 0..1 =1}: A clone matched to where it lands: the colour difference along the patch's rim is spread smoothly over it, so texture comes from the source and tone from the surroundings. With a mask, the rim is read only where the mask is (so dark edges beside a narrow opening do not tint it) and only the masked pixels change spot {x 0..1 (required), y 0..1 (required), r 0.001..0.1 (required)}: Heal a small disc from the best nearby source: 48 places around it (3 distances, 16 directions) are scored by how well their surroundings match, on a grid set by the spot's size, so every size picks the same one remove {stroke, shape, feather 0..0.25, opacity 0..1 =1}: Remove a distraction (wire, pole, person, blemish) in one call from surrounding real pixels with seamless boundary matching (never generative fill): give a stroke {points, width}, shape ({kind: "ellipse", cx, cy, rx, ry} or {kind: "stroke", points, width}), or mask mask (optional, on any op but crop, straighten and turn): {shapes?: [...], range?: {by, from, to, soft?}, select?: {id}, invert?}, at least one of shapes, range and select. select: a smart selection photo_select made (its id): the subject, the background, the sky or an object, as a model found it; with shapes or range it applies only where both do; invert: true then means everything but it. A selection is made on the photo after its crop, straighten and turn, so a select mask goes on an adjustment after those (or on an adjust layer, or a layer's mask); change the crop, straighten or turn afterwards and select again. range picks pixels by their own value as the photo is at that step: by "luma" (0..1), "hue" (degrees, from 330 to 30 is the reds; grey is left out) or "saturation" (0..1), soft fading outside from..to in the same units (default 0.1, or 20 for hue); with shapes it applies only within them. Each shape: {kind: "ellipse", cx, cy, rx, ry, angle?, feather}, {kind: "rect", x, y, w, h, r?, angle?, feather}, {kind: "linear", x1, y1, x2, y2} (full at the first point, none at the second), {kind: "radial", cx, cy, r, feather}, {kind: "stroke", points: [[x, y], ...], width, feather}, each with mode "add" (default), "subtract" or "intersect". Everything is a fraction of the picture: x and widths of its width, y and heights of its height, radii, widths, feather and sigma of its long side.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"edits": "<edits>"
},
"name": "photo_edit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| next | No | what the next call will do | |
| note | No | what this call does, shown to people watching | |
| edits | Yes | ||
| canvas | No | ||
| preview | No | ||
| request_id | No | ||
| expected_revision | No |