Refine Text · PixText
Rewrite a Word Exactly
- model
- image
- targets
- image
- edit_footprint
- metadata
Ask a modern edit model to change one word on a sign and you'll get a good word back on a subtly different photo. That's not a complaint about quality - Qwen, Kontext and Klein are genuinely great at "make this say Nayeon" - it's a complaint about everything else in the frame, which comes back close-but-not-identical, and then compounds across a chain of edits.
Refine Text · PixText is the node that fixes exactly that. You give it an image, your target boxes with their strings, and it regenerates only those footprints in pixel space. Everything else comes back bit-identical. This is the specialist you reach for when the composition is already perfect and the only thing wrong is the caption.
How it works
The pipeline is a crop-and-stitch loop with a glyph renderer bolted on, and the glyphs are the interesting part.
For each group of up to 12 targets, it plans geometry at the original resolution aligned to 16-pixel patches, builds context conditioning from the surrounding pixels, and renders every target string as an image with the package's bundled fonts - PuHuiTi first, Go Noto as the fallback if the string needs glyphs the first font lacks. The model then samples with two conditions in play: what the region looks like now, and what the target text should look like as glyphs. Guidance between glyph-present and glyph-absent predictions is what pushes the result toward legible characters rather than "text-shaped texture," over the open interval 0.1 to 1.0.
Compositing happens at reference resolution and only the edited footprints are restored, so unmasked pixels come back identical rather than "very close."
Inputs and outputs that matter
model from Load PixText Model, image from the Region Editor, targets from that same editor. Those last two are checked against each other by size and a pixel digest, so nothing can drift out of sync unnoticed.
Then three settings:
seed- 42 by default, withcontrol_after_generateattached. Worth knowing: because that widget fires after the run by default, the number in the box is the seed for the next generation. Find a repair you love, flip it tofixedimmediately. (Same trap as every KSampler; see the plumbing notes on widget control modes.)steps- real sampling steps, not a denoise. 4 for MeanFlow, 25 for Teacher, per the tooltip. Setting 25 on MeanFlow is not "more quality," it's six times the time on a model trained to take a shortcut. Match the number to the package.guidance- 3.3, the pack's own default for both variants. Nudge up for stubborn glyphs, down if the repaired word starts looking pasted-in and too crisp for its surroundings.
Outputs: image (goes to Save Image and to Compare Regions' after), edit_footprint (a MASK of the actual edited crops - hand it to a blur node if you want to soften the seam, or use it to composite onto a higher-res frame), and metadata, a JSON string with model identity, seed, sampling settings, crop geometry and which font got picked per target. That last one is the record you want when a repair looks great and you can't remember which variant produced it.
Install
The refiner needs the pack plus a model package, nothing else:
cd ComfyUI/custom_nodes
git clone https://github.com/ATH-MaaS/PixText.git
python -m pip install -r PixText/requirements.txt
Drop a complete package into ComfyUI/models/pixtext/PixText-MeanFlow/ (weights, config.json, inference_config.json, manifest.json, and the fonts/ folder), restart, and pick it in the loader.
Where people get burned
Nothing happens and you get your image back. That's the zero-enabled-targets path: no crash, output equals input, and metadata reads {"status": "no_enabled_regions"}. Go back to the editor, tick boxes, apply regions.
"Connect the image and targets from the same PixText Region Editor." Something resampled or replaced the image between the editor and the refiner. If you want to work at 2× for finer text, upscale before the Region Editor so the whole chain sees one resolution.
CUDA or bust. The refiner hard-requires an NVIDIA GPU and raises if the device isn't CUDA - the module uses FlexAttention, and there's no CPU fallback for editing, only for loading packages. On an unsupported card you can build the whole graph and watch it fail at the first run.
VRAM and time both scale with target count. More than 12 targets means multiple passes, no parallelism, so a 26-word poster is three passes and roughly three times the wall clock.
One word per box. The README's guidance is literal: one character or a text line per target. Cram a paragraph into a rectangle and you get a rendered blob, because the model is told "this region contains this string," not "typeset this layout." Split it into boxes and let grouping handle the count.
And on the pack's reputation: it's new, and the community corpus has essentially nothing on it - no drama, no broken-workflow threads, no learned workarounds. Which means the node's error messages are currently the best documentation there is. Read them; they're unusually specific.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| model | PIXTEXT_MODEL | — | |
| image | IMAGE | — | |
| targets | PIXTEXT_TARGETS | — | |
| seed | INT | 420–9223372036854776000 | — |
| steps | INT | 41–100 | Actual sampling steps. Recommended: MeanFlow 4, Teacher 25. |
| guidance | FLOAT | 3.30–20 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| edit_footprint | MASK | — |
| metadata | STRING | — |