Nodes/MOSS BBOX Prompter/MOSS BBOX Reference Crop
ComfyUI Node

MOSS BBOX Reference Crop

Pull one box out of your reference image

By ukr8b3g-cmyk·Created about a month ago·Updated about 12 hours ago· 10
MOSS BBOX Reference Crop
  • framing_data
  • image
  • IMAGE
◄box_id►

What it actually does

The job here is smaller than the name suggests: it hands you the pixels inside one box you drew on the MOSS BBOX Canvas. The source file's own docstring calls it a "reference-only crop. No prompt mutation, preview files or model management." That's the whole node.

Why would you want that? Because the pack's headline trick is describing a reference image in words and stuffing that description into a box's prompt. The bundled all-in-one node, MOSS BBOX Image Analysis, does that with comfy's core Generate Text. Reference Crop is the DIY half of the same move: if you'd rather use your own captioner - Florence, Qwen-VL, a text-gen node with a vision-capable CLIP - this feeds it the right pixels. Whole-image captioning gets you "a woman in a red dress stands in a crowded street"; a crop of the red box gets you the woman in the red dress.

One bit of context, since it explains why a crop is even a node. Per-subject prompts are regional prompting, the long-standing fix for two characters swapping hair colours, and it's been unclosed since 2023. The classic implementations mask attention per region, which leaks at the borders and leaves a collaged look. MOSS-Image sits in the newer camp where boxes are part of the prompt itself, like Ideogram 4's JSON caption schema - so a box's text here is just words in a caption, and a crop is just something to feed a text pipeline.

How the crop is computed

It does not re-open the original file. You feed it the Canvas's framing_data (a JSON blob tagged krea2_element_framing_v1) plus an IMAGE, and it maps canvas coordinates onto that image with a contain fit: scale by whichever of width/height is tighter, centred, with letterbox margins. Box edges are clipped to the visible image area, then rounded outward, and if the crop's longest side is over 1024 px it's downsampled bilinearly with antialiasing.

Two consequences. The crop matches what you see under the box in the Canvas preview, which is what you want. And it's soft if you drew a huge box over a huge reference - 1024 px is the ceiling by design, because this node exists to feed a vision model.

The inputs that matter

framing_data comes from MOSS BBOX Canvas and nowhere else. image is the reference image (a Load Image output works); despite being optional in the schema, execution fails without it, and it must be a single RGB image, not a batch. box_id is the odd one: an advanced text field holding the box's stored ID. Empty does not mean "auto" here - that's the Image Analysis node's behaviour, not this one. An empty or stale ID raises "Select one existing box."

The single output is IMAGE. Wire it into the image input of a captioning or text-generation node.

The wiring that makes it useful

The pack's older reference-analysis template wires it exactly like this:

MOSS BBOX Canvas.framing_data ──┐
Load Image.IMAGE ───────────────┴─→ MOSS BBOX Reference Crop ──→ Generate Text (image in)
Generate Text.generated_text ──→ MOSS BBOX Text Link.text
MOSS BBOX Text Link.external_text ──→ MOSS BBOX Prompter.external_text

The point of the last two hops is Text Link: it lets the analysed words replace one box's body without overwriting your saved manual prompt, so flipping back to manual is a disconnect rather than a regret.

Install

ComfyUI Manager → Install via Git URL → paste the repo, restart ComfyUI, then Ctrl+F5. Or the manual way:

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

The pack declares zero dependencies (dependencies = [] in pyproject.toml, no requirements.txt), so nothing pip-installs and nothing breaks. But these nodes target ComfyUI's newer V3 authoring API - if comfy_api isn't importable, the pack quietly registers nothing and this node never appears in the list. Update ComfyUI if that happens.

Model files belong to the generation side: the templates expect a MOSS-Image int8 checkpoint, a qwen3.5_9b text encoder and a VAE, plus rgthree-comfy for V2's Power Lora Loader. You need those to generate, not to crop.

Things that will bite you

"Select one existing box." You left box_id empty, or you deleted and redrew the box, which mints a new ID. Delete the node and re-add it to resync, or grab the current ID.

"Box does not overlap the reference image." Your canvas aspect ratio doesn't match the reference, so the image is letterboxed with margins, and you drew a box out in the margin. Hit Match image size on the Canvas - which rounds to a multiple of 16 and scales every box proportionally - or move the box back over the picture.

"Invalid Canvas framing data." The wire isn't coming from a MOSS BBOX Canvas, or it's from a legacy node. Wire framing_data straight across.

A very soft crop. That's the 1024 px cap. Fine for captioning, wrong tool if you wanted full-resolution pixels for something else - use an ordinary crop node for that.

One honest caveat about the whole approach: the crop becomes text. It is not image conditioning, and no amount of crop precision guarantees the identity, lettering or layout comes back in the render. You're describing, then generating.

Categoryconditioning/MOSS

Inputs (3)

NameTypeDefaultDescription
framing_dataKREA2_ELEMENT_FRAMING_DATA—
box_idSTRING—
imageoptIMAGE—

Outputs (1)

NameTypeDescription
IMAGEIMAGE—