PixText Region Editor
The Region Editor Is the Whole Workflow, Boxes and All
- image_in
- detections
- image
- targets
- regions_preview
Most inpainting in ComfyUI is a mask and a denoise value, and the model's job is "put something plausible here." PixText is not that. Its job is "put this exact word here, in the typeface the scene already uses" - which means the model needs something a mask can't express: the target string, per region, and a rectangle that's actually the text's bounds rather than a loose blob.
PixText Region Editor is where you supply that. It's a canvas node: click Open Region Editor, draw rectangles over the text you want changed, type what should be there instead, hit Apply regions. That's the input half of the entire pack.
The mechanism worth understanding
Behind the panel, the node holds a JSON document - version 1, an image source id, the image size, and a list of regions with bbox, text, and enabled. Every rectangle you draw writes into that string, which is serialized into the workflow, so your boxes survive saving and reopening. That's a bigger deal than it sounds: the layout decisions are the expensive part of the work here.
On execution, the node validates that document against the image it's actually holding. Wrong source id, wrong dimensions, a region off the edge of the frame, more than 256 regions - any of those and it emits region_message to the UI instead of targets, and blocks downstream. Quiet failure in the editor, hard stop in the graph. Contrast that with what usually happens: you tweak a box, forget to apply, and get a silently stale result.
Coordinates are plain original-image pixels, (x0, y0, x1, y1), half-open. The pack aligns crops to 16-pixel patches internally, and the edited footprint can extend past the box you drew - the preserve-exactly promise applies to pixels outside that footprint, not outside your rectangle. Draw a box that hugs the word and you'll be fine.
Inputs and outputs
Two required fields. image is the same upload-or-pick dropdown the rest of ComfyUI uses - files from ComfyUI/input plus the bundled example: Chinese New Year. region_data is the JSON, exposed as a multiline text box; you'll almost never open it, but it's there and it's readable.
The optional sockets are where the two workflows diverge:
image_in- wire an upstream IMAGE here when the picture was generated in the graph instead of uploaded. The tooltip warns you it needs a run to refresh the editor's preview, so: connect, run once, then open the editor.detections- wire thePIXTEXT_DETECTIONSfrom Detect Words and the panel opens pre-populated with every detected word, each switched off until you tick it. The check is strict by design: detections and image must come from the same detection pass, and the region document must carry a matchingdetection_id, or you get "Review OCR suggestions in the Region Editor and Apply regions before refinement." The author is refusing to let you refine guesses you never looked at.
Three outputs: image (the exact pixels it worked from), targets (the PIXTEXT_TARGETS document that feeds both Refine Text and Compare Regions), and regions_preview - your image with numbered, color-coded boxes, which is also what gets drawn on the canvas.
Install
Nothing node-specific - it's part of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/ATH-MaaS/PixText.git
python -m pip install -r PixText/requirements.txt
Restart ComfyUI, then refresh the browser tab. The editor panel is JavaScript that ships in the pack's web directory, and a stale frontend cache is the reason a freshly-installed node shows up as a bare text box with no Open Region Editor button. Hard refresh before you file a bug.
Where people get burned
"Different image detected. Existing regions were not applied." You swapped the source image and the saved regions belong to the old one. Correct behavior - silently reusing boxes from an image of different dimensions would paste your edits in the wrong places. Expect to redraw when you change inputs.
Batches. The node takes one RGB or RGBA image; feed it an image batch and it says so outright. If you're looping, the editor runs per image.
"Select an image from ComfyUI's input directory." Files picked from the dropdown must live in ComfyUI/input. If you point it at a path elsewhere, it refuses. Drop the file in the input folder, or bring the image in over image_in instead.
Editing region_data by hand. Genuinely viable for headless or repeated runs, if you know one detail: for a file-based image the source id is file:<filename>, so a hand-written document with {"version": 1, "source_id": "file:poster.png", "size": [1024, 1024], "regions": [{"bbox": [120,80,160,125], "text": "Nayeon", "enabled": true}]} passes validation.
The habit that saves the most time: review before you refine, every time. Open the editor with detection on, tick only the words that are wrong, fix the target text, apply. The pack caps refinement at 12 targets per pass and auto-groups the rest, so over-selecting costs you a longer progress bar for work you didn't want.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | COMBO | example: Chinese New Year | 2 options: example: Chinese New Year, example.png |
| region_data | STRING | {} | — |
| image_inopt | IMAGE | Optional upstream image. Run once to refresh its editor preview. | |
| detectionsopt | PIXTEXT_DETECTIONS | Connect detections and image from Detect Words. Review and apply before refinement. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| targets | PIXTEXT_TARGETS | — |
| regions_preview | IMAGE | — |