Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The one-shot route

✅ verified · segment -> trace, two steps · a route is not code, it is the order the steps run in (each step’s main.py names at the top which steps it reads) · one picture, one route, one subproject · the two stages themselves are ch. 1 and ch. 8

in one line

Solve the vector edges and the value bands out of the source, use strokes only for the difference, and paint it in one go. No draft, no gate, no completion, no lines. It answers the question “can a diffusion image become a 4K painting where every pixel has a provenance” – it can, and it looks right; it does not answer “can an artist take it over”.

The chain

the one-shot route

  the picture ──► step01-segment   the hand-written table cuts the subject into named
                     (ch. 1)         sub-parts and gives each one a sub-pixel outline;
        │                            the majority vote runs, but nothing downstream reads it
        ▼
                 step02-trace      reading: each sub-part is cut into bands by value, one
                     (ch. 8)         sub-pixel outline per band, and strokes are planned to
        │                            cover only what the bands miss
        │                          painting: the layer tree is built, then painted stroke by
        ▼                            stroke, and the criteria are measured in the same step
                 the finished .kra

Two steps, and a person’s only real work is at the first one.

The phases

phasestepsthe milestone
phase1-layers/step01-segmentthe subject is cut into named sub-parts
phase3-paint/step02-tracethe finished painting, and the criteria on it

There is no phase2-draft/ at all on this route. Phase 2 is the draft, and the draft exists to be a gate; this route has no gate, so the directory is never created. The numbering is global to the subproject and does not restart per phase, which is why the second step is step02 and not phase3’s first.

Phase 1: the layers

step01-segment

The question it answers: which pixel belongs to which named part.

upstreamthe picture, and this picture’s parts table
producesthe subject cut into named sub-parts, one sub-pixel outline per sub-part, and a numbered map of the raw regions
a person doesfills the region numbers into the parts table – see below
look atthe three-column review image (the hand-written table, the majority vote, and what the vote changed) and the region map
the gateeach sub-part is the thing it is named after, all the way round its edge
if it failsfix the table and rerun the same step
costsneeds ComfyUI, for one mask per word; well under a minute
the stage itselfch. 1 · the field names: appendix G · the file names: appendix F

This route uses only the hand-written half of the step. The majority vote still runs and still shows up in the review image, but nothing downstream reads it: the parts the tracing works from come straight from the table a person wrote. That is why the table has to be right here and cannot be repaired later – there is no completion and no draft to catch it.

Filling in the table: the first run does not count

The first run of a new picture stops as soon as it has written the region map, because the table is still empty. Read the region numbers off that map into the parts table – which regions make up which sub-part, ordered bottom to top by occlusion – and run the same step again under the same number. The stopped run is not a step and consumes no number.

The phase verdict

The phase’s README.md says in one line what the phase produces, and a person writes its ## Verdict when the phase closes. Here that verdict is short: this route’s phase 1 is the segmentation and nothing else.

Phase 3: the painting

step02-trace

The question it answers: can this picture be painted at 4x with every pixel having a provenance.

upstreamthe segmentation step
produceseach sub-part cut into value bands, one sub-pixel outline per band, a stroke plan for what the bands miss, the layer tree, and then what Krita paints from it: the .kra, the composite, the painting journal and the review images
a person doesnothing, until it is time to look
look atthe 1:1 close-ups – at least the face, the neck, a hand and a foot
the gateno pixel is written bare: every write carries its reason
if it failsthere is nothing upstream to fix but the table, so a failure here sends you back to step01
costsreading the picture runs at 1x and takes about two minutes; Krita takes about seven
the stage itselfch. 8 · the file names: appendix F

The knobs that matter are three: the multiplier (4x by default – 1x planning is the same either way, only the painting scales), how much detail earns a stroke (raise it and fewer, larger differences get painted), and how long a mark may be (max_aspect, 3 by default; the hair strands and the skin hatching are off by default for the same reason, ch. 8). All of them are constants at the top of this step’s main.py.

Measuring: the criteria

The criteria run inside this step by default, so this chain really is two steps long and not three. A separate stepNN-gauge is worth opening only when you want something the trace step cannot do on its own: the same rulers pointed at another painting, or the matching-position comparison against the other route’s finished picture. That comparison only exists once both routes have been run.

One criterion fails here by design: the description count. The claim of this route is “value bands plus strokes for the difference”, and hundreds of band groups is what that costs. The criteria count it and report it; they do not gate it. What is gated is that no pixel was written bare.

The phase verdict

phase3-paint/’s verdict covers the painting and the criteria together, because on this route they are one step.

Redoing a step

A step that a person judges a failure is moved aside – renamed with a legacy-wrong suffix, kept in its own phase as a record – and the rerun uses the same number. Failures consume no numbers, so the living chain stays consecutively numbered. Grep the subproject for the old name and point the references at the new one; each downstream main.py names the steps it reads at the top, and changing that constant is what changes the upstream.

A step kept as a record of an experiment rather than a failure gets a legacy-experiment suffix instead.

When to take this route

Take it when you want a picture that resembles the source and can be enlarged, and you have no interest in the layers; when you want speed; or when you want a yardstick – this route is where the ceiling on interior sharpness and likeness sits, and the other route is measured against it. Do not take it when the deliverable is a file an artist will open and edit.

What it costs

Reading the picture runs at 1x and does not depend on the multiplier, on the order of two minutes; the Krita half spends a minute or two building the tree (several hundred nodes, each vector layer needing addShapesFromSvg) and a few minutes painting (tens of thousands of strokes, a hundred thousand calls). Memory is its weak point: three layers per band group, several hundred paint layers each filled by an airbrush, plus every group’s projection – at 8x that reaches a dozen gigabytes and more (ch. 18).

limitations

The layers are not what a person wants; with no completion, hiding the dress leaves the legs cut in two; the strokes are dots rather than lines; and the hand-written table cannot separate two things that share a region.

On origin

The numbers, the tree, the close-ups and the matching-position comparison against the other route: ch. 19.