Nodes/MOSS BBOX Prompter/MOSS BBOX Canvas + Prompt (Hybrid)
ComfyUI Node

MOSS BBOX Canvas + Prompt (Hybrid)

One node, boxes in, prompt out

By ukr8b3g-cmyk·Created 10 days ago·Updated 3 days ago· 6
MOSS BBOX Canvas + Prompt (Hybrid)
    • prompt
    • width
    • height
    • moss_json
    ◄moss_state{"schema_version":"moss_bbox_v1","prompt":"","width":896,"height":1184,"slots":{"red":"","blue":"","yellow":"","green":"","magenta":"","cyan":"","orange":""},"boxes":[],"settings":{"auto_position":false,"active_slot":"red","draw_mode":false,"selected_id":null}}►

    This is the shortest path from "I want a person on the left and a title on top" to a string you can paste into a CLIP Text Encode. MOSS BBOX Canvas + Prompt (Hybrid) is a whole layout editor and prompt builder in a single node: draw boxes, type what goes in them, and it emits the finished prompt.

    One caveat up front, because it'll save you a rewrite: this node is legacy. The pack's current path is MOSSSharedCanvas → MOSSFromKrea2, which gives you a choice of output formats. This one always emits the same hybrid string. That's not a defect - it's just one less decision - but if you're building something you'll maintain, start with the shared pair.

    What problem it solves

    MOSS-Image reads layout-conditioned captions: a summary, then items each with a label and a bounding box in centralized pixel yxyx. That's a real capability and also a genuinely different prompting style - the model was trained on structured captions, so plain natural-language prompts undershoot what it can do. The same pattern showed up with Ideogram 4, where a JSON caption schema plus a canvas node turned a "weird, won't obey me" model into a controllable one.

    The catch: writing that JSON by hand means computing box edges relative to the image center, and doing it once per subject, per composition. This node deletes that step.

    How the output is assembled

    Everything runs on CPU in pure Python - build_prompt() parses moss_state, walks the boxes in canvas order, and generates two things at once.

    The natural-prose half looks like this per box: Character (box 1, red): then your color description, and if it's a text box, a Text to render: line beneath. The JSON half is the official schema:

    {"summary":{"caption":"your whole-image prompt"},"items":[{"label":"object","caption":"red ceramic teapot","bbox":[-592,-448,592,448]}],"bbox_coord_space":"abs_centralized","bbox_format":"yxyx"}
    

    Hybrid output is the prose, a blank line, then that JSON. The moss_json output gives you the JSON alone if you want to feed a node that wants only the schema.

    Coordinate conversion is specific and worth trusting: raw canvas xyxy pixels are sorted, floored/ceiled, then shifted by width // 2 and height // 2. No round-trip through the integer 0–1000 grid the native node uses, so the exporter's boxes can differ from the core path by about a pixel per edge. Nobody will see that pixel.

    Inputs and outputs

    Input: moss_state (a STRING widget the bundled canvas UI writes into - don't hand-edit it).

    Outputs - all four matter at some point:

    • prompt → the text input of CLIP Text Encode, on the positive side.
    • width / height → Empty Flux 2 Latent, both of them, converted to inputs if needed.
    • moss_json → optional, for graphs that want the schema without prose.

    Colours are editor organization, not a palette that leaks into the image. All boxes of one colour share that colour's description; each box keeps its own type and its own text string.

    Install

    ComfyUI-Manager → Install via Git URL with https://github.com/ukr8b3g-cmyk/MossImage-BBOX-Prompter, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ukr8b3g-cmyk/MossImage-BBOX-Prompter.git
    

    Restart ComfyUI, then Ctrl+F5. The package declares zero pip dependencies and ships its own UI, so there's no separate Krea2 install despite the internals being adapted from that suite (MIT, attributed in NOTICE.md). What you do need from outside: MOSS-Image weights in a ComfyUI build that supports the architecture, plus rgthree-comfy if you want to open the bundled standard and DMD example workflows.

    Traps worth knowing

    Multiples of 16, or nothing. 896×1184 is the default and a good default. 900 gets you a ValueError, because the latent node would truncate it.

    No boxes means an empty items array. The official core node falls back to returning your plain prompt when there's nothing boxed; this legacy combined node emits the envelope anyway. If you're debugging "why is there a JSON at all", that's why.

    Unboxed descriptions survive - as prose. Type a colour description but never draw that box, and it lands in the prose section with a warning rather than being dropped. Layout JSON has no way to express it, which is exactly why you should either draw the box or delete the text.

    It will not summarize, translate, or expand. Braces, punctuation, whitespace and language pass through as typed. No wildcard expansion, no LLM rewrite, no API call. If your output looks like a robot wrote it, that was the input.

    Conflicting position words get flagged, not fixed. Say "the red kettle on the left" while the box sits on the right and the node warns about the mismatch, keeps your text, keeps the coordinates, and generates something confused. Move the box.

    Categoryconditioning/MOSS

    Inputs (1)

    NameTypeDefaultDescription
    moss_stateSTRING{"schema_version":"moss_bbox_v1","prompt":"","width":896,"height":1184,"slots":{"red":"","blue":"","yellow":"","green":"","magenta":"","cyan":"","orange":""},"boxes":[],"settings":{"auto_position":false,"active_slot":"red","draw_mode":false,"selected_id":null}}—

    Outputs (4)

    NameTypeDescription
    promptSTRING—
    widthINT—
    heightINT—
    moss_jsonSTRING—