Skip to main content
Cleanup, the Inpainting stage, removes each text’s lettering from the scan. The result goes into the text block’s clean-up, which shows only inside the block’s mask, under its translation. The scan itself never changes.

Fills come before the model

Most lettering sits on plain paper or a smooth gradient, which a fill rebuilds exactly and at once. A model there can add texture or tint, so Koharu uses one only where it’s needed. For each lettering, Koharu reads a ring of unmasked pixels just past its mask, inside its balloon or panel, and the first tier that can rebuild the ring fills the mask: Lettering that isn’t one colour all round is judged again for each separate piece of its mask, since detection can mask a stray piece on other paper or on a balloon’s line. Only what a piece’s paper doesn’t reach, such as a part past the balloon’s outline, goes to the model.

How the model redraws

The model works in windows at the page’s own scale. Each window holds a lettering whole with 256 pixels of context around it, merged with the windows it overlaps while the merge stays within about a megapixel, and never spans two panels. A whole page shrunk to fit a model left lettering untouched, and a large window shrunk the same way left glyph-shaped patches; at the page’s own scale, neither happens. Each lettering is redrawn in one window only, and the model sees every lettering in its window masked, not only the ones it redraws there.
LaMa, fine-tuned on manga, redraws under the mask and takes no prompt. Only the masked pixels are kept, so its result can’t reach past the lettering.

Remove and Generative Fill

A Remove stroke is a run of its own: inpainting on the painted area, with the inpainting model in Settings → Pipeline. All of the area goes to the model, with no fill tiers. It reads the page as it’s drawn, earlier clean-ups, paint, and fills included, but without lettering, as Photoshop’s Remove tool samples all layers. Another stroke over a result builds on it, and translated text is never baked into the fill. The result goes onto the raster layer or clean-up selected in Layers, and a selected clean-up’s mask opens where you painted. With nothing selected, it goes onto a new raster layer limited to the area, which stays selected for the next strokes. Generative Fill draws what its prompt asks into an area marked with Rectangular Marquee or Lasso. It has its own model, FLUX.3 Klein unless you pick another, kept for the next fill as Photoshop’s Generative Fill keeps its own. A fill model the settings don’t use stays loaded for five minutes after the last fill, so filling again doesn’t load it again.

When a clean-up goes wrong

Design and sources: the koharu-pipeline README.