Josia框选编辑
The bounding-box editor that still works if you never switched to Nodes 2.0
- 底图
- 边界框
- 提示词
- 预览图
- 边界框
- 元素
What this node is actually for
ComfyUI's built-in Create BoundingBoxes gives you a blank node. That's not a bug on your end - the drawing canvas behind it is a Vue widget from the 2.0 frontend, and the old LiteGraph canvas doesn't know what to do with that widget type, so it draws nothing. If you're still on the legacy frontend - and plenty of people are, because Nodes 2.0 has been breaking widely used packs since late 2025 - you can't draw a box with it at all.
Josia框选编辑 is a stand-in for exactly that. It puts a real editor inside the node panel (plain DOM plus a <canvas>, under the pack's own control) and emits data in the same shapes the official node emits, field for field. Whatever downstream node accepts the official boxes accepts these. The alternative is switching your frontend and hoping your other packs survive it.
Why care about boxes? Because region control is one of the few things better prompt adherence hasn't eaten. The 2026 twist is that boxes stopped being a bolt-on: Ideogram 4 was trained on bounding boxes inside its JSON caption schema, and Krea 2 follows them zero-shot because its Qwen3-VL encoder saw them during training. The other half is masking - the standard inpaint trick now is to ground an object, take its box, pad it, and fill that region. Both want a coordinate editor you can see.
How it works
You draw. Each box is stored as fractions of the canvas (0–1), not pixels, which is why swapping the background doesn't scramble your work. The editor then serialises everything to JSON into a hidden 框数据 string widget that travels with the workflow; the Python side parses that string and builds all four outputs.
Two details that bite later:
- The parse is forgiving on purpose. A malformed character gives you an empty box list instead of a red graph, and one bad box is dropped while the rest survive.
- It reproduces the official formats, quirks included.
元素uses a[ymin, xmin, ymax, xmax]ordering on a 0–1000 grid - y first, not x.边界框is a double-nested list, one inner list per batch frame, deliberately without metadata. Colours get uppercased and capped at five, because downstream nodes may string-compare them. Someone read the source here.
The inputs you'll touch
- 画布宽度 / 画布高度 (64–16384, default 1024×1024) - the pixel grid the boxes live on. Since boxes are fractions, these only decide the coordinates you get out. Fill in your target output resolution.
- image - a dropdown of images in your ComfyUI
input/folder, with the native upload button alongside. Pick one and it becomes the canvas background, and canvas dimensions snap to that image's size, greying out the two fields above. Wire the port and the port wins. - 框数据 - leave it alone. The editor writes it.
Optional and genuinely useful: 底图 (IMAGE). Wire Load Image or a VAE Decode here and the preview updates live as upstream output changes, turning this into a rerun-and-reframe loop instead of a guess-and-queue loop.
The outputs, and where they go
- 预览图 (IMAGE) - boxes drawn over the darkened background, or a grey field if you gave it nothing. Native resolution since 0.1.4, so the coords match what you're looking at.
- 边界框 (BOUNDING_BOXES) - pixel-integer rectangles. The one for crop nodes, VAE-encode-region, inpaint regions, tiled processing. The official Create BoundingBoxes also accepts it back if you want to reuse a layout as a draft.
- 元素 (ARRAY) - the layout-element list:
type,bbox,text,desc, optionalcolor_palette. This is what FLUX 3-style and MOSS-Image-style "describe each region" nodes want. - 元素JSON (STRING) - the same as a string, for prompt assembly or a Save Text node.
It's an output node, so it runs with nothing downstream. It's a legitimate way to just look at boxes.
Installing it
ComfyUI Manager, search JosiaNodes Lab, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Josia-doit/ComfyUI_Josia_Lab
Restart. Nothing else - pyproject.toml declares an empty dependency list and there's no requirements.txt, because the node needs only numpy, torch and PIL, which ComfyUI already ships. No models. The pack is explicitly an experimental sidecar to the author's main ComfyUI_JosiaNodes, so treat the interface as movable.
Where people get burned
Sharing the workflow. The image dropdown is built from your input/ folder at load time. Send the workflow elsewhere and that filename won't resolve - and with no background, the canvas falls back to the panel's 画布宽度/画布高度, so your coords land on the wrong grid. For anything meant to travel, wire 底图 from a Load Image.
Box order is layer order. Background elements first, foreground last. Overlapping boxes in the wrong order put the wrong element in front, and nothing warns you.
A text box needs its 文字 filled in, or you export an element that claims to be text with nothing in it. 描述 is what layout nodes actually read, so keep it a short noun (dress, logo), not a sentence.
No thumbnail under the node - the preview lives in the embedded canvas, and ui.images is intentionally empty. The 预览图 port still works fine.
Snapping to the centre line and to other boxes' edges and midlines is on by default with cyan guides, plus eight resize handles and a minimum-size guard. More polished than a one-file experimental node has any right to be.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| 整体描述 | STRING | 用一两句话描述整张图的整体画面、主体与构图, 例如:清晨的森林里一只鹿站在溪边。 留空时「提示词」端口只汇总各框的描述。 | |
| 画布宽度 | INT | 102464–16384 | — |
| 画布高度 | INT | 102464–16384 | — |
| 框数据 | STRING | [] | — |
| image | COMBO | 🖼️请选择或上传图像… | 从 input 目录选一张图当画布底图,或点控件右侧的上传按钮传图。 有图像时:画布与坐标按图像尺寸走,上方分辨率自动灰化。 「底图」端口接线时本项自动灰化 —— 端口优先。 |
| 底图opt | IMAGE | 接上游图像当画布底图:实时显示上游预览,画布与坐标按图像尺寸走。 | |
| 边界框opt | BOUNDING_BOXES | 接「创建边界框」等节点的边界框输出。 编辑器为空时:执行后自动按画布尺寸灌入这些框。 编辑器已有框时:不灌入,手画的框优先。 | |
| 布局导入opt | STRING | 接上游一段布局提示词,还原进本节点:整体描述填进文本框,各框自动生成。 支持本节点「提示词」端口导出的 JSON,也支持 MOSS 同款布局 JSON; 纯文本则整段当整体描述并清空各框。 执行(点节点播放)后生效,回填编辑器;不接线则不导入、不动现有内容。 |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| 提示词 | STRING | — |
| 预览图 | IMAGE | — |
| 边界框 | BOUNDING_BOXES | — |
| 元素 | ARRAY | — |