image_to_ascii
Convert an image file into ASCII art by brightness and stamp it onto the current canvas at specified coordinates, returning the placed size for layout.
Instructions
Convert an image file (png, jpg, webp, ...) into ASCII by brightness and stamp it onto the current canvas at (x, y). Ideal for photo/logo density art. Uses jp2a's fine 23-step tonal ramp by default for smooth gradation. The image is fitted to max_width columns (rows are derived from its aspect ratio). Returns the placed size so you can size the canvas first.
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": {
"path": "<path>"
},
"name": "image_to_ascii"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | ||
| y | No | ||
| path | Yes | Absolute or relative path to the image file. | |
| ramp | No | Custom density ramp from empty to full. Overrides `ramp_preset`. | |
| edges | No | Structure-aware: draw contours as | - / \ strokes over the fill, for crisper silhouettes. | |
| gamma | No | Midtone gamma (extends jp2a's linear mapping). 1 = off; <1 deepens shadows, >1 lifts them. | |
| dither | No | Fake continuous tone from few ramp steps: 'bayer' = ordered cross-hatch, 'floyd' = Floyd–Steinberg grain. Pairs well with the 'blocks' or 'classic' ramp. | none |
| invert | No | Flip dark/bright — use for dark subjects on a light background. | |
| max_width | No | Target width in characters. | |
| ramp_preset | No | Built-in ramp: 'jp2a' = 23-step smooth tone, 'classic' = 10-step graphic, 'blocks' = solid shade blocks (░▒▓█), 'braille' = fine braille tone. Ignored if `ramp` is given. | jp2a |
| transparent | No | Composite over existing art — skip blank cells so the image layers on top instead of erasing the background. | |
| auto_contrast | No | Stretch the brightness range to use the full ramp (sharper result). | |
| edge_threshold | No | Edge sensitivity 0..1 (lower = more contour strokes). |