DEV Community

AI-KSK
AI-KSK

Posted on

Z-Image local repaint with LanPaint: giving the patch its context back

Z-Image's Turbo model is fast and, for local repaint, close to context-blind. It does not read the surroundings of the region you are repainting, so the patch comes back technically correct and visually alien. This episode's fix is LanPaint.

Watch the episode: https://youtu.be/jLgtxPpjjWo
Chinese original: https://www.bilibili.com/video/BV1CbmmBREPn

The problem being solved

Local repaint with the Turbo model fails on context: change a corner of an image and the model renders that corner as if the rest of the frame did not exist. It also struggles on non-human references - a pose-transfer source that is not a person is where the pipeline usually falls apart.

What LanPaint adds

LanPaint is a sampling strategy rather than a new model. Instead of one denoising pass on the masked region, it runs a thinking-style sampling that keeps re-reading the surrounding context while the region is being rebuilt. The practical effect: the repainted patch knows what it is sitting next to.

What to expect

  • Edges that agree with the frame: shadow direction, micro-contrast and colour cast survive the boundary.
  • Better behaviour on non-human reference sources, which is the case the episode compares directly.
  • More time per repaint - thinking-sampling is not free.

Where it still fails

  • If the content you are inserting is physically inconsistent with the scene, no amount of context reading fixes it.
  • Very large masks still behave like a new render with a soft boundary.
  • This is a workflow technique, not a downloadable package; no weights or graphs are bundled with this article.

The general lesson

Repaint quality is mostly a context problem, not a resolution problem. The difference between a patch that looks pasted and one that looks photographed is whether the sampler looked at the neighbourhood - which is exactly the thing a fast distilled model skips.

Top comments (0)