Edit an image
image_editPrepare images for printing in one call: trim scanner borders, split multi-photo scans, straighten, remove backgrounds, crop, resize, and enhance documents. Returns print-ready file paths.
Instructions
Clean up and prepare images in one call, no other software needed: trim scanner borders, split several photos/cards scanned together into separate files, straighten, remove background, crop, rotate, resize, upscale, denoise, sharpen, enhance a document scan, adjust colours, round corners. Ops run in order. Returns file paths to use with print or layout_page.
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": {
"source": "<source>",
"ops": "<ops>"
},
"name": "image_edit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dpi | No | Write this resolution into the file metadata | |
| ops | Yes | Ops (each item is {op, ...params}; defaults in brackets): trim {threshold=14, padding_px=6, background="auto"|"white"|"#rrggbb"} crop the uniform border (scanner glass), ignores dust; split {min_area_pct=2, padding_px=10, threshold=14, deskew=true} one file per object on a plain background; must be last; deskew {max_degrees=15} straighten a tilted page; remove_background {method="auto"|"color"|"ai", tolerance=24, feather=1.5} transparent PNG; crop {x,y,width,height}; rotate {degrees, fill="transparent"|"auto"|css colour}; flip {horizontal,vertical}; resize {width,height,scale,fit="inside"|"contain"|"cover"|"fill",kernel="lanczos3"}; denoise {strength=2 (1-5)}; sharpen {amount=1 (0-3)}; upscale {scale=2 (2-4)} (smooth enlarge, not AI); enhance_document {mode="color"|"gray"|"bw", strength=1}; adjust {brightness,contrast,saturation (-100..100), hue (deg), gamma (0.1-5)}; grayscale {}; invert {}; threshold {value=160}; round {radius_px | circle:true}; border {width_px, color="black"}; pad {top,right,bottom,left,color="transparent"} | |
| format | No | Default: png when transparency is produced, else the source format | |
| source | Yes | Local image path (png, jpg, webp, tif, gif, bmp, svg) or a data: URI | |
| quality | No | JPEG/WebP quality, default 92 | |
| overwrite | No | Allow output_file to replace an existing file | |
| output_dir | No | Folder for the results. Default: the print-mcp images folder (files older than 7 days are removed there) | |
| output_file | No | Exact output path ending .png, .jpg, .jpeg or .webp. Never overwrites unless overwrite is true. With split, a -1, -2 suffix is added |