Flutgraben e.V.'s graphic toolbox: command-line tools that turn pictures and type into fields of dots and back, sharing one document format so any tool, person or AI can chain them. Bun, TypeScript, one dependency, no build step. MIT.
What it is for: a poster-sized plate that sets a text in several scripts into a dot field — packed once, reworded in seconds, printed at any size in millimetres.
The idea
A picture becomes a field of dots: circles of varied size packed so they never touch. The packing is blind to the picture; every dot takes its colour from what lies under it. So the form lives in colour alone — which is the contract of a colour-blind test plate, and what lets a tool change what the field says without moving a dot.
The field is the document (fltgrbn.dotfield, a JSON file: canvas, palette, dots, and
the provenance of every tool that touched it). PNG and SVG are exports of a document,
never the document — the way a layered file is the work and a flat image is what you hand
out. Every tool reads a document or a picture and writes a document or a picture; chain them
as you like.
picture ──ishihara──▶ document ──recolor(text mask)──▶ document ──palette-swap──▶ document ──export-print──▶ PNG + SVG at N mm
▲
set-type ───────┘ (the text mask, from paragraphs at the largest size that fits)
Run
bun install
bun tools/ishihara/tool.ts picture.png --rmin 1.6 --rmax 4.5 --gap 0.5 --palette 16 --bg paper
bun tools/set-type/tool.ts picture.png --paras paras.json --margin 300 --mask out/text.png
bun tools/recolor/tool.ts out/picture.dotfield.json --text out/text.png --ink '#4a3628' --name typed
bun tools/export-print/tool.ts out/typed.dotfield.json --mm 284x430 --rotate cw --name print
Every tool prints its usage with no arguments. Every tool's contract is its tool.json.
The tools
| tool | in → out | what it is for |
|---|---|---|
ishihara |
picture → document | pack a picture into a plate of dots, colours snapped to the picture's own inks |
set-type |
picture + paragraphs → picture + mask | set type at the largest size that fits, rotated like a card title, any script |
recolor |
document + masks → document | erase an old figure, ink a new one, without moving a dot |
palette-swap |
document → document | recolour into colour families paired by lightness: test plate, gold on green, … |
export-print |
document → PNG + SVG | to paper at a size in mm; rims, painted gold, registered layers |
image-dots |
picture → PNG + SVG | the stipple cousin: size and density carry the picture |
dct-atoms |
picture → alphabet | an atom alphabet from a JPEG's own compression |
band-type |
word → PNG | progressive-resolution banded type |
dot-screen |
browser | the live tool: drop a picture, turn the dials, print it big |
The contract
A tool is a folder under tools/ with three files:
tool.ts— a Bun script. Reads files named on the command line, writes into--out. Never prompts, never reads the network, never keeps state. Every random draw comes fromlib/hash.tsand a--seed, so the same inputs give the same bytes.tool.json— the manifest: what it is, its inputs and outputs with types and defaults, which document it reads and writes, an example, and a self-test — the arguments to run it on the synthetic fixture and the files, with hashes, it must produce.README.md— the same, for people.
bun scripts/new-tool.ts <name> stamps one from the template. bun scripts/check.ts runs
every self-test; the pre-push hook runs the same, locally — nothing here runs on a server.
For AI systems. The manifest is the interface, and it reaches an agent three ways, all derived from it, none written twice:
- Shell. An agent that can run a command has the whole toolbox:
bun tools/<name>/tool.ts …, documented bytool.json. - Skills.
.claude/skills/<name>/SKILL.md, generated bybun scripts/gen-skills.ts, tells Claude Code or Cowork when to reach for a tool and how;.claude/skills/graphic-toolbox/is the hand-written one for the pipeline as a whole. The gate fails if a generated skill is stale. - MCP.
bun mcp/server.tsexposes every tool over the Model Context Protocol with an input schema built from its manifest, pluspreview, which returns a downscaled PNG of any output as an image. Add it to Claude Code withclaude mcp add graphic-tools -- bun /path/to/mcp/server.ts, or to Claude Desktop / Cursor as{ "command": "bun", "args": ["/path/to/mcp/server.ts"] }.scripts/mcp-smoke.tsproves it with the SDK's own client; the gate runs it.
Layout
document/ the dotfield format: schema + open/save with provenance
lib/ hash (the one random source), args, colour, the bundled OFL font, the synthetic fixture
tools/ one folder per tool; _template/ is the boilerplate
scripts/ check.ts (the gate), new-tool.ts, gen-skills.ts, mcp-smoke.ts
mcp/ server.ts — the toolbox over the Model Context Protocol
.claude/ skills/ (generated per tool + the pipeline skill), memory/
Provenance
Grown out of the Flutgraben dashboard's DotFont engine (hashRand, the atom box).
DINish is bundled under the SIL Open Font License.