Nodes/comfyui-OreX/Create Bounding Boxes (OreX)
ComfyUI Node

Create Bounding Boxes (OreX)

The core box editor, minus the renderer roulette

By orex2121·Created 2 years ago·Updated a day ago· 56
Create Bounding Boxes (OreX)
  • background
  • bboxes
  • preview
  • bboxes
  • elements
  • character_boxes
◄width1024►
◄height1024►

ComfyUI already ships its own Create Bounding Boxes node, so the OreX copy isn't trying to one-up it. It exists for a duller reason: its editor is a plain DOM canvas that also works with the legacy (Nodes 2.0 disabled) renderer, where a lot of node-side editors quietly stop drawing. The docstring says it plainly - "This is an independent OreX node; ComfyUI's original node remains unchanged."

Why you'd want boxes at all: layout prompting. The current crop of text-heavy models - Ideogram 4's JSON boxing, MOSS-Image's character layout - put objects where you tell them, and "where you tell them" means coordinates. The most reliable way to get three subjects in the right third of the frame - and the most tedious thing in ComfyUI when you type the numbers by hand.

How it works

The editor is a DOM widget drawing a 2D canvas at the aspect ratio of your width/height widgets. Boxes are stored as fractions of that canvas in the node's properties, and the pack hooks graphToPrompt to stuff that state into a hidden editor_state string at queue time - which is why they survive in your workflow JSON.

On the backend it hands the regions to the core module's boxes_to_regions, render_preview, fractions_to_bbox_frame and build_elements - pixel boxes plus prompt elements on the 0..1000 grid - with one OreX-specific fix in _build_elements: for Text regions it rewrites the description into styling guidance and drops the color_palette key. The source comment explains why: MOSS treats a text item's palette as the colour of the whole region and renders dark letters on a coloured panel instead of letters over the scene.

The inputs and outputs that matter

  • width / height - the coordinate space, default 1024×1024, step 16. Set these to your generation resolution before you draw. They don't come from the background image; the canvas just changes shape.
  • background (IMAGE) - optional, purely visual. It dims your reference image behind the boxes so you can trace an existing composition. You only see it after the first run: the frontend saves it to temp and loads it back via /view.
  • bboxes (*, forceInput) - feed boxes in from another node and the editor adopts them. The source only overwrites your drawn regions when the incoming set changes since last run. A stable input leaves your hand edits alone; an input that reshuffles every run will silently eat them.
  • preview (IMAGE) - boxes over the background, rendered straight out of the node.
  • bboxes (BOUNDING_BOX) - pixel-space boxes, one frame per image. This is the wire you actually use: crop, paste and region nodes all take that type.
  • elements (ARRAY) - Ideogram/FLUX-style prompt elements on the normalised 0..1000 grid.
  • character_boxes (STRING) - a comma-separated list of every box you typed as Character, numbered to match the 01, 02 labels drawn in the editor, ready for MOSS-Image Layout Prompt's character_boxes input.

Per box you pick a type (Object, Character, Text), write a description, and for Text a literal text field - shown only for that type. Colour swatches cap at five; right-click removes one. Click empty canvas to create a box, drag to move, grab the bottom-right handle to resize, Delete to remove the selected one (the extension swallows that key while the editor has focus, so you don't nuke the node).

Install it

Manager search "Orex Nodes" (the registry name - the repo is comfyui-OreX), or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/orex2121/comfyui-OreX
pip install -r comfyui-OreX/requirements.txt

Restart, then hard-refresh the browser - the editor is a JS extension, and a cached frontend is the usual reason a custom widget doesn't show up. Two honest warnings. First, that requirements.txt is the whole pack's (mediapipe, modelscope, transformers>=4.43.2, opencv, the audio stack, lmstudio). This node needs none of it, but you install all of it. Second, this node is not in the pack's README - the menu lists 31 nodes and bounding boxes isn't one of them, so don't read its absence as a fault. It lives under OreX/Utilities.

Common issues

It's not in the node list at all. The module does from comfy_extras.nodes_bounding_boxes import ..., so it needs a ComfyUI new enough to have the native node. On an older build that import fails and the pack's loader prints [OreX] Failed to load module 'OreX_CreateBoundingBoxes' with a traceback, then carries on loading everything else. Fix: update ComfyUI.

Boxes land somewhere other than where you drew them. Nine times out of ten width/height don't match what you're generating. The editor is telling you the truth about a 1024×1024 grid.

After an update. The README's first line, in both languages, is to delete the pack folder and reinstall rather than patch in place. Reads like shouting; also the fastest fix for a node that vanished.

CategoryOreX/Utilities

Inputs (4)

NameTypeDefaultDescription
widthINT102464–16384—
heightINT102464–16384—
backgroundoptIMAGE—
bboxesopt*—

Outputs (4)

NameTypeDescription
previewIMAGEPreview of the boxes over the optional background.
bboxesBOUNDING_BOXPixel-space bounding boxes, one frame per image.
elementsARRAYIdeogram/FLUX prompt elements on the normalized 0..1000 grid.
character_boxesSTRINGComma-separated numbers of every box marked Character, ready for the MOSS-Image Layout Prompt character_boxes input.