Nodes/ComfyUI-ArchAi3d-Qwen/ArchAi3D_Position_Guide_Prompt_Builder
ComfyUI Node

ArchAi3D_Position_Guide_Prompt_Builder

The rectangle-mapping prompt builder for Qwen Edit

By amir84ferdos·Created 11 months ago·Updated 5 months ago· 70
ArchAi3D_Position_Guide_Prompt_Builder
    • formatted_prompt
    • system_prompt
    object_descriptions
    prompt_templatestandard
    custom_template
    system_prompt_templateuser_validated
    custom_system_prompt
    additional_instructions
    removal_at_startnone
    removal_at_endcombined

    Getting Qwen-Image-Edit to put multiple objects in a scene with a specific layout is where prompt writing breaks down - "put the boy on the left, the man next to him" is a coin flip. The trick this node uses is old-school and brutally effective: you hand the model a reference image with numbered red rectangles drawn where things should go, and the prompt tells it "object 1 goes in rectangle 1, object 2 in rectangle 2." The model reads the image, maps your descriptions to the boxes, adds the objects, and the prompt also tells it to remove the red rectangles and numbers when it's done.

    What it does

    ArchAi3D_Position_Guide_Prompt_Builder turns a list of object descriptions into that placement prompt. You feed it:

    • object_descriptions - slash-separated descriptions, each mapped to a rectangle in order. "boy seats on sofa / man seats on sofa / woman seats on sofa" means rectangle 1 gets the boy, rectangle 2 the man, rectangle 3 the woman.
    • prompt_template - the cleanup strategy. standard (combined removal command) is the default; standard_explicit splits the removal into separate commands if rectangles or numbers leak into the output; strong_removal adds an IMPORTANT prefix for stubborn cases; no_removal keeps the boxes visible for debugging; minimal is just the mappings; custom uses your own template.
    • system_prompt_template - seven options, from user_validated (the recommended one, a "your working prompt" with a 3-stage cleanup) through three_stage (explicit Read → Add → Clean process) to none. The preserve_everything and minimal_change options are there for when the scene matters more than the placement.
    • custom_template / custom_system_prompt - escape hatches that use {MAPPINGS} and {ADDITIONAL} placeholders when you pick the custom presets.
    • additional_instructions - free-form extras like "man is close to boy" or "warm lighting, photorealistic style".
    • removal_at_start and removal_at_end - where the removal command goes, and how it's worded (combined, rectangles_only, numbers_only, both_separate). The defaults put a combined removal at the end.

    Outputs

    Two strings: formatted_prompt - the complete prompt, ready for your Qwen encoder - and system_prompt, which is empty if you selected none.

    How it works under the hood

    The node is a structured template composer. It builds the mapping list from your slash-separated input, wraps it in the chosen template, and appends the removal instructions at start and/or end. The real work happens in the model: Qwen-Edit 2509's vision side reads the numbered rectangles from the guide image, and the natural-language instruction maps your descriptions onto them. It's the same "the image is part of the prompt" trick that makes Qwen Edit good at instruction editing in general - you're just making the instruction machine-readable by giving it coordinates to hang on.

    When to reach for it

    Composition shots where layout matters and you're tired of rolling the dice: seating charts, product-lineup shots, "three characters in a scene" work. It pairs with an image-editing workflow where you first draw the guide (numbered rectangles on a copy of the image), then feed the original plus the guide into the encoder alongside this prompt.

    Install + notes

    Pack install - ComfyUI Manager ("ArchAi3d Qwen") or:

    cd ComfyUI/custom_nodes && git clone https://github.com/amir84ferdos/ComfyUI-ArchAi3d-Qwen.git
    cd ComfyUI-ArchAi3d-Qwen && pip install -r requirements.txt
    

    Restart, find it under ArchAi3d/Utils. The biggest gotcha is leaky cleanup: if red boxes or digits show up in the output, step the template up - standardstandard_explicitstrong_removal. That escalation ladder is the entire troubleshooting guide, and it works.

    CategoryArchAi3d/Utils

    Inputs (8)

    NameTypeDefaultDescription
    object_descriptionsSTRINGDescribe objects separated by / (slash). Example: 'boy seats on sofa / man seats on sofa / woman seats on sofa'. Each description will be mapped to rectangle 1, 2, 3... in order.
    prompt_templateCOMBOstandardTemplate preset: - standard: Combined removal command (default) - standard_explicit: Split removal (use if rectangles/numbers appear in output) ⭐ - strong_removal: Ultra-explicit with IMPORTANT prefix (use if standard_explicit fails) ⭐⭐ - no_removal: Keep rectangles visible (for debugging) - minimal: Just mappings, no extra commands - custom: Use custom_template field below
    custom_templateSTRINGCustom template (only used when template is 'custom'). Use {MAPPINGS} for object mappings, {ADDITIONAL} for extra instructions. Example: 'Add to image 1 using image 2 guide: {MAPPINGS}. {ADDITIONAL}'
    system_prompt_templateCOMBOuser_validatedSystem prompt template: - user_validated: YOUR WORKING PROMPT with 3-stage cleanup! (recommended) ⭐ - three_stage: Explicit 3-stage process (Read→Add→Clean) ⭐⭐ - none: No system prompt - standard: Basic guidance + removal reminder - detailed: Precise placement + explicit removal - preserve_everything: STRONG preservation + removal rules - minimal_change: Short and direct with removal - custom: Use custom_system_prompt field below
    custom_system_promptSTRINGCustom system prompt (only used when system_prompt_template is 'custom'). Example: 'You are an expert in architectural visualization...'
    additional_instructionsSTRINGExtra details to add at the end (optional). Example: 'man is close to boy' or 'warm lighting, photorealistic style'
    removal_at_startCOMBOnoneAdd removal instruction at START of prompt: - none: No removal at start - combined: 'remove all red rectangles and numbers from the image' - rectangles_only: 'remove all red rectangles from the image' - numbers_only: 'remove all numbers from the image' - both_separate: Both commands separately (rectangles, then numbers)
    removal_at_endCOMBOcombinedAdd removal instruction at END of prompt: - none: No removal at end - combined: 'remove all red rectangles and numbers from the image' (default) - rectangles_only: 'remove all red rectangles from the image' - numbers_only: 'remove all numbers from the image' - both_separate: Both commands separately (rectangles, then numbers)

    Outputs (2)

    NameTypeDescription
    formatted_promptSTRINGComplete formatted prompt ready for Qwen image editing
    system_promptSTRINGSystem prompt (empty if 'none' selected)