Compare Regions · PixText:
PixTextCompare, displayed in ComfyUI as “Compare Regions · PixText,” helps you visually review local text repairs by presenting matching views of every enabled target region before and after refinement. Instead of searching through an entire artwork for small lettering changes, you can inspect each selected area with surrounding context and its target text label. This makes it easier to assess whether a repair improved readability, preserved the intended lettering, and blended naturally into the nearby artwork. The node also checks that the original artwork matches the image associated with your region selections, helping prevent misleading comparisons against an unrelated image. It is a visual review tool: it does not perform text repair, calculate accuracy scores, or automatically decide whether a result is better.
Compare Regions · PixText Input Parameters:
before
A required IMAGE containing the original artwork before text repair. This serves as the reference for the comparison and must match the source image associated with your PixText Region Editor targets. The node checks both the image dimensions and a SHA-256 fingerprint calculated from its pixel data; matching width and height alone is not enough. Using a resized, recolored, recompressed, or otherwise changed version can cause validation to fail if its decoded pixels differ. For the most reliable workflow, connect the same original image used by the region editor directly to this input. No numeric range, selectable options, or default image is defined.
after
A required IMAGE containing the artwork after text repair, typically the repaired image from your PixText refinement workflow. The node uses the selected target regions to extract corresponding views from this image, allowing you to compare the repaired lettering with the original lettering. Use a result that preserves the original image’s dimensions and spatial alignment so that each crop shows the same area of the artwork. The provided node code does not explicitly validate this image’s dimensions against the original before calling the comparison helper, so you should not rely on it to catch alignment problems. No numeric range, selectable options, or default image is defined.
targets
A required PIXTEXT_TARGETS connection carrying the region selections associated with your original artwork. These targets supply the image dimensions, the original image’s pixel fingerprint, and the edits used to identify and label the regions being compared. Each edit supplies its target text, which is included in the comparison cards alongside the before-and-after previews. This connection determines which regions you review; the node does not independently detect text or create replacement targets. Use the targets from the same PixText Region Editor workflow as the original image, rather than substituting an OCR document or manually constructed data. No numeric range, selectable options, or default value is defined.
padding
A required INT controlling how many context pixels are included around each target in both comparison crops. The default is 6, the minimum is 0, and the maximum is 64. This is an advanced setting. Smaller values keep the comparison tightly focused on the lettering, while larger values show more nearby artwork so you can inspect how a repair fits its surroundings. For example, 0 minimizes added context, while 16 provides more space around the selected text. Padding affects the comparison views, not the repair itself, and does not change which regions are selected.
Compare Regions · PixText Output Parameters:
contact_sheet
An IMAGE containing the assembled visual comparison sheet for the selected target regions. It brings the before-and-after region views together into one image, allowing you to inspect local text changes without repeatedly navigating the full artwork. You can connect it to compatible image preview or saving nodes to review or retain a record of the comparison. It is a review image rather than a repaired full-resolution artwork, a mask, or a numerical quality score. In addition to this single image output, the node supplies its interface with per-region comparison cards containing a one-based index, the target text, and before-and-after previews; these cards are interface information, not additional output sockets.
Compare Regions · PixText Usage Tips:
- Connect the original image to both your region-editing workflow and
beforewithout inserting pixel-changing processing on only one branch. This keeps the source-image validation consistent. - Connect the repaired artwork to
afterbefore applying resizing, cropping, or other transformations that change its alignment. Matching image dimensions alone does not guarantee that the selected regions still point to the same content. - Start with the default
paddingof 6 for routine text checks. Reduce it toward 0 when you want to focus closely on letter shapes, spacing, and stroke details. - Increase
paddingto values such as 16 or 32 when you need to examine nearby textures, borders, or background continuity. Larger values include more context but can make the text less visually prominent in a comparison view. - Review the target text labels alongside the rendered lettering. The labels show the intended text associated with each edit, but the node does not verify that the repaired image actually spells it correctly.
- Save
contact_sheetalongside the repaired artwork when comparing refinement attempts. Keep the original image, targets, and padding consistent between attempts to make visual review more reliable.
Compare Regions · PixText Common Errors and Solutions:
Target regions and input image have different dimensions
- Explanation: The width and height stored in
targetsdo not match the dimensions ofbefore. This check happens before the comparison is generated and commonly indicates that the original image was resized or cropped after the targets were created. - Solution: Reconnect the exact original image used in the PixText Region Editor. If you intentionally changed the image dimensions, create targets for that changed image and use it consistently throughout the repair and comparison workflow.
Use the original image from the same PixText Region Editor
- Explanation: The original image’s dimensions passed validation, but its pixel fingerprint does not match the fingerprint stored in
targets. An unrelated image or a version with altered pixels can trigger this error even when the dimensions are identical. - Solution: Use the original image connection associated with those targets. Remove intervening color adjustments, recompression steps, or other pixel-changing operations from the
beforebranch, or recreate the targets using the image you now intend to process.
KeyError: 'size', 'source_digest', or 'edits'
- Explanation: These are possible Python errors if the target data is missing a field that the node accesses directly. They indicate incomplete or incompatible target data rather than a problem with the lettering itself.
- Solution: Reconnect a valid PIXTEXT_TARGETS output from the matching PixText Region Editor workflow and execute that upstream workflow again. Avoid substituting other document types or manually assembled data for the targets.
Comparison crops show different areas or appear misaligned
- Explanation: This is a visual problem rather than an explicit error message in the provided code. It can occur when
afterhas been cropped, resized, shifted, or otherwise rearranged relative tobefore. The node explicitly validates the original image against the targets, but the shown code does not perform an equivalent alignment check on the repaired image. - Solution: Compare the repaired image before any downstream geometry changes. Ensure that both images have matching dimensions and that the text occupies the same positions in each image; increasing padding does not correct a shifted or resized result.
