PixText Introduction
PixText is a text-repair tool for images. It helps you correct misspelled words, repair damaged lettering, and refine unclear characters without regenerating the whole image.
You provide three things:
- An image you want to edit.
- Boxes around the text that needs attention.
- The exact replacement text you want to appear. PixText then refines those selected regions using the surrounding image as context. This makes it useful when you are happy with an artwork’s composition but need to fix its lettering.
For example, you can use PixText to:
- Correct a misspelled name in a caption.
- Repair several damaged words in the same image.
- Refine individual Chinese characters.
- Replace a character or a line of text in a selected region. PixText is designed for localized repairs, not whole-image regeneration. Pixels outside the actual edit areas remain unchanged. The actual edit areas can be slightly larger than the boxes you draw because of how PixText processes image patches.
PixText is available through ComfyUI, as well as Python and command-line interfaces. The ComfyUI workflows let you draw boxes, enter replacement text, and compare repairs visually.
Hardware requirement: Text refinement requires an NVIDIA GPU with CUDA support.
How PixText Works
Think of PixText as a retoucher working on small pieces of your image rather than repainting the entire canvas.
1. You identify what needs fixing
Draw a box around a word or character and enter its correct text.
For example, if an image contains the name Nayeen but should say Nayeon, you select that word and provide Nayeon as the target.
PixText uses your supplied text as the correction. You do not need to describe the desired spelling in a long prompt.
2. PixText creates a visual guide for the lettering
PixText renders your target text using bundled fonts. This produces a glyph guide: a visual reference showing the shapes of the letters or characters.
A glyph is simply the visible shape of a character. You can think of the guide as a lettering reference that helps the model understand what it should draw.
The bundled renderer tries these fonts in order:
- Alibaba PuHuiTi
- Go Noto CJK Core It uses the first font that supports the entire target string. These fonts provide guidance; they are not separate text-refinement models.
3. PixText refines the selected regions together
PixText works in pixel space, meaning it operates on image pixels rather than relying on a separate VAE to convert the image into and out of a compressed representation.
It processes selected text regions together, using surrounding image content as context. Up to 12 targets are processed per pass, in the order you provide them.
4. The repaired areas are returned to the image
PixText’s processing crops align to a 16-pixel patch grid. As a result, an actual edit area may extend beyond your drawn box.
Pixels outside those actual edit areas remain identical to the original image after it has been oriented correctly and converted to RGB.
Overview of the PixText refinement pipeline
PixText Features
Precise, localized text editing
Each edit consists of a box and replacement text. A target can be:
- A single character.
- A word.
- A line of text. This lets you repair only the parts that need attention instead of asking an image generator to recreate the whole composition.
For programmatic use, boxes use original-image pixel coordinates:
text (x0, y0, x1, y1)
Here, (x0, y0) is the upper-left corner and (x1, y1) is the lower-right boundary. The right and bottom boundaries are excluded from the box.
If an image contains orientation information, PixText first turns it upright. Coordinates must match that upright image.
Multiple repairs in one image
You can supply several text corrections together. For example, the included English example repairs four words, while the Chinese example contains 13 character regions.
PixText handles up to 12 targets per pass. Targets are processed in input order.
Visual region editing in ComfyUI
The Region Editor lets you draw or adjust boxes and enter the correct text without manually writing coordinates.
You can:
- Review the location of each repair.
- Change its target text.
- Enable the regions you want to refine.
- Save the workflow to retain your boxes and replacement text. This is especially useful when returning to an artwork for another revision.
Optional automatic word detection
The English ComfyUI workflow includes Detect Words, which can locate word boxes and read their current text using OCR.
OCR means optical character recognition: software that attempts to read text from an image.
Detection provides a starting point, not a substitute for reviewing the correction. You can adjust the detected boxes and replace the recognized text before refinement.
OCR is optional. MeanFlow refinement itself does not require an OCR model. The automatic-detection workflow has separate OCR dependencies and model files, described in the OCR documentation.
Before-and-after comparison
The Compare Regions node lets you inspect individual repairs. Open comparison opens the full comparison gallery.
Use this view to check:
- Whether the replacement text is correct.
- Whether all intended regions were repaired.
- How the repaired lettering fits into the surrounding image.
Adjustable sampling settings
Sampling steps are the model’s successive refinement updates.
| Setting | What it controls | How to approach it |
| --- | --- | --- |
| Steps | The number of refinement updates. | Start with the selected model’s defaults: 4 for MeanFlow or 25 for Teacher. |
| Glyph guidance | How strongly the sampling process uses the rendered character guide. | Both models default to 3.3. If experimenting, compare the result against this baseline. |
| Seed | The starting random state used during generation. | Keep it fixed when comparing settings so you are not also changing the starting randomness. |
In the command-line interface, --steps and --guidance-scale override the package defaults.
The provided documentation does not establish a universal “best” guidance value or guarantee that increasing steps improves every repair.
A technical distinction: Four MeanFlow steps do not mean exactly four model evaluations. With default glyph guidance, four updates require seven model forward evaluations.
Reproducibility information
Python results include metadata recording information such as:
- Model identity.
- Seed.
- Sampling settings.
- Sample identity.
- Crop geometry. The command-line interface saves a PNG and a JSON metadata file with the same base name. The example runner also saves reproduction metadata beside its output.
These records help you keep track of the settings used for a particular result.
Flexible image handling and batch processing
PixText accepts local image paths or Pillow images and supports arbitrary image dimensions.
The Python interface also supports batch editing, with separate edits and seeds for each image. Each image uses its own noise and blur streams.
PixText Models
PixText provides two refinement models.
| Model | Default sampling | Default glyph guidance | Suggested use |
| --- | --- | --- | --- |
| PixText-MeanFlow | 4-step interval Euler | 3.3 | The author recommends starting here. Its lower update count makes it the first option to try for routine repairs and iteration. |
| PixText-Teacher | 25-step Euler | 3.3 | Use it as an alternative to compare against MeanFlow on the same image and target text. |
PixText-MeanFlow
MeanFlow uses four sampling updates by default.
It runs without an additional:
- Text encoder.
- OCR model.
- VAE.
- Teacher model. You do not need to load PixText-Teacher to use MeanFlow.
PixText-Teacher
Teacher uses 25-step Euler sampling by default. The provided https://github.com/ATH-MaaS/PixText/tree/3ba8100171ab54ce26271590332ddb5481664d7b/examples show its results alongside MeanFlow so you can inspect how the two models handle the same repairs.
The model name and higher step count do not establish that Teacher will produce the better result for every image. Compare the actual outputs for your artwork.
What the model packages contain
Complete packages are available from Hugging Face. Each includes:
- Model weights.
- Model and inference configuration.
- Bundled fonts.
- A manifest and SHA-256 checksums for checking file integrity.
When the Python interface loads a local package, it checks the files listed in the manifest. The repository’s
model_index.jsonlists model identifiers and weight checksums.
Using PixText in ComfyUI
Draw and refine text manually
The Chinese example demonstrates manual region editing:
MeanFlow workflow · Teacher workflow
ComfyUI workflow showing the PixText model loader, region editor, refiner, and comparison nodes
- Open the workflow from Templates → PixText, or drag its JSON file onto the ComfyUI canvas.
- Choose a model in Load PixText Model.
- Click Open Region Editor.
- Draw or adjust the text boxes and enter the desired characters or words.
- Click Apply regions.
- Click Run.
- Review the repairs in Compare Regions, or select Open comparison for the full gallery.
- Save the workflow if you want to retain the boxes and target text. The included example contains an image with 13 text regions.
Detect words, then adjust and refine
The English workflow adds automatic word detection:
ComfyUI English workflow with word detection, editable regions, and text refinement
With the OCR components available:
- Open the English workflow.
- Upload your image in Detect Words, or use the provided example.
- Click Run to detect word boxes and read their text.
- Open Region Editor.
- Check the boxes and enter the correct replacement words.
- Enable only the regions you want to repair.
- Click Apply regions.
- Click Run again to refine the selected words.
- Inspect the before-and-after results.
The example targets are
Nayeon,Nicola,crossbody, andfashionable.
PixText Examples
The examples/ directory contains input images, target text, and outputs from both models. Click the images below to inspect them at full size.
Chinese character refinement
| Input with marked regions | MeanFlow — 4 steps | Teacher — 25 steps | | --- | --- | --- | | [Chinese input with edit boxes](https://github.com/ATH-MaaS/PixText/blob/3ba8100171ab54ce26271590332ddb5481664d7b/examples/pipeline_case/input_boxed.png) | [Chinese MeanFlow result](https://github.com/ATH-MaaS/PixText/blob/3ba8100171ab54ce26271590332ddb5481664d7b/examples/pipeline_case/meanflow_output_boxed.png) | [Chinese Teacher result](https://github.com/ATH-MaaS/PixText/blob/3ba8100171ab54ce26271590332ddb5481664d7b/examples/pipeline_case/teacher_output_boxed.png) |
The cyan boxes identify the selected repairs.
Unannotated images: Input · MeanFlow · Teacher
English caption repair
This example repairs four damaged words, including changing the misspelled name Nayeen to Nayeon.
| Input with marked regions | MeanFlow — 4 steps | Teacher — 25 steps | | --- | --- | --- | | [English caption input with edit boxes](https://github.com/ATH-MaaS/PixText/blob/3ba8100171ab54ce26271590332ddb5481664d7b/examples/english_case/input_boxed.png) | [English caption MeanFlow result](https://github.com/ATH-MaaS/PixText/blob/3ba8100171ab54ce26271590332ddb5481664d7b/examples/english_case/meanflow_output_boxed.png) | [English caption Teacher result](https://github.com/ATH-MaaS/PixText/blob/3ba8100171ab54ce26271590332ddb5481664d7b/examples/english_case/teacher_output_boxed.png) |
Unannotated images: Input · MeanFlow · Teacher
Both supplied https://github.com/ATH-MaaS/PixText/tree/3ba8100171ab54ce26271590332ddb5481664d7b/examples use seed 42.
Troubleshooting PixText
ComfyUI reports a missing model
- Check which model is selected in Load PixText Model.
- Review the missing-model dialog to identify the required weights.
- Confirm that the selected model is available to the ComfyUI instance running the workflow.
- Refresh the model list after the file becomes available.
- Select the model again and rerun the workflow. If you use a remote ComfyUI server, the model must be on that server—not only on your own computer.
Automatic word detection does not run
The OCR workflow requires components that are separate from PixText refinement.
- Check the workflow’s OCR model downloads note.
- Confirm that all three OCR files are present in the listed folders.
- Use the verification information in OCR setup to check the files.
- Confirm that the OCR dependencies are available in ComfyUI’s Python environment.
- Restart ComfyUI after dependency changes and try detection again. If automatic detection is unnecessary, use the manual Region Editor workflow instead.
The wrong word or character was repaired
- Open Region Editor.
- Check that the box surrounds the intended text.
- Read the target text carefully, including spelling and punctuation.
- Confirm that the correct region is enabled.
- Click Apply regions before running again.
- Review the result in Compare Regions. For coordinate-based edits, check that the coordinates refer to the upright, original-size image.
A small area outside my box changed
PixText aligns its processing crops to 16-pixel patches. The actual edit area can therefore be larger than your box.
- Inspect the repair at full size.
- Distinguish the drawn box from the larger processing area.
- Check preservation outside that actual edit area. The preservation guarantee applies outside the actual edit areas, not necessarily immediately outside the drawn boxes.
Refinement cannot run on the current machine
- Confirm that the machine performing refinement has an NVIDIA CUDA GPU.
- If you are using remote ComfyUI, check the server’s hardware rather than your browser device.
- Distinguish an OCR problem from a refinement problem: the two have separate requirements. The supplied documentation does not describe a supported CPU-only refinement workflow.
A local package fails validation
- Confirm that you are using a complete package for the intended model.
- Check that its weights, configuration, fonts, and manifest-listed files are present.
- Compare the files against the supplied checksums.
- Replace incomplete or mismatched files with the matching files from the official model repository.
Frequently asked questions
Do I need OCR to use PixText? No. You can draw boxes and enter replacement text manually. OCR is only needed for the automatic-detection workflow.
Does PixText decide the correct spelling for me? You supply the desired replacement text. OCR can read existing text, but you should review it before refinement.
Can I repair more than one word? Yes. PixText processes multiple targets, with up to 12 per pass.
Does MeanFlow require Teacher? No. MeanFlow runs independently.
Do I need to add the bundled fonts as system fonts? No. Fonts are included with the ComfyUI nodes and complete Python model packages.
Which languages are demonstrated? The provided https://github.com/ATH-MaaS/PixText/tree/3ba8100171ab54ce26271590332ddb5481664d7b/examples demonstrate Chinese characters and English words. Font coverage determines whether the renderer can produce a guide for a target string; the documentation does not provide a comprehensive language-support list.
Will Teacher always look better? The documentation does not make that guarantee. Start with MeanFlow and compare Teacher if you want an alternative.
Learn More about PixText
- ComfyUI Registry — PixText’s ComfyUI listing.
- Example workflows — Ready-made workflows for manual region editing and English word detection.
- Example images and results — Compare original images with MeanFlow and Teacher repairs.
- OCR documentation — File requirements and verification information for automatic word detection.
- Model packages — Official model weights and associated package files.
- Research paper — The author’s technical explanation of Efficient Scene-Text Refinement via Pixel-Space Grouped Image Generation.
- TextRefinementBench — The linked benchmark dataset for text-refinement research and evaluation.
PixText License
PixText is released under the Apache License 2.0. See LICENSE for the full terms.
