Nodes/ComfyUI-ArchAi3d-Qwen/πŸ“ Extract Region Text
ComfyUI Node

πŸ“ Extract Region Text

Turns region-annotated prompts into a clean list of instructions

By amir84ferdosΒ·Created 11 months agoΒ·Updated 5 months agoΒ· 70
πŸ“ Extract Region Text
    • text
    β—„textβ–Ί

    This is a tiny regex utility with a specific job, and it's worth knowing precisely because it's unglamorous. Qwen-VL editors love being told about image regions in a structured way. A common pattern - used throughout this pack's region-based prompting - is annotating each area with a color, a quoted instruction, and a position:

    (region 1: #FF0000, "add the oven on the left side", left)
    (region 2: #0000FF, "add table and chairs", right)
    

    That structured form is great for you to write and for a region-guide image to visualize, but it's noisy to feed to a model. ArchAi3D_Extract_Region_Text strips the annotations and hands back just the instructions, cleaned up:

    add the oven on the left side.
    add table and chairs.
    

    How it works

    One input (text), one output (text), zero tuning. The node runs a regex for everything inside double quotes, strips whitespace, appends a period where one's missing, and joins the results with newlines. That's the entire mechanism - it's a re.findall over "([^"]*)" with light cleanup. If there's a bug, it's the kind you can debug by eye.

    Where it slots in

    You'd use it between a region prompt builder (the pack's position-guide and room-transform tooling produces exactly this annotated format) and a multi-image text encoder. The cleaned sentence list is what actually gets encoded alongside your region-guide image, so the model receives one instruction per region in the same left-to-right order the guide image shows. If you're building these prompts by hand, the node's real gift is that you can keep your annotations in a compact single string and let it expand them for the encoder - you get readability in, cleanliness out.

    It also works on any quoted-text extraction, not just the pack's format. Parsing a log, pulling quoted terms out of a generated prompt, whatever - it doesn't care about the region syntax.

    Install and caveats

    Part of the ArchAi3D Qwen pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/amir84ferdos/ComfyUI-ArchAi3d-Qwen.git
    

    No extra pip packages needed - pure Python stdlib. Restart ComfyUI and find it under ArchAi3d/Edit/Region.

    Two small caveats. First, it only pulls double-quoted text; single quotes or unquoted instructions pass straight through untouched, so keep your format consistent. Second, it's a text transformation, not a prompt quality tool - if your quoted instructions are vague, the cleaned output is still vague, just tidier. And since the pack's license applies to all of it: free personal, paid commercial.

    CategoryArchAi3d/Edit/Region

    Inputs (1)

    NameTypeDefaultDescription
    textSTRINGRegion descriptions with quoted text to extract

    Outputs (1)

    NameTypeDescription
    textSTRINGβ€”