--- license: apache-2.0 tags: - comfyui - comfyui-node - custom-node - controlnet - openpose - pose-editor --- # comfyui_Bonso_Tools ![Bonso Tools](assets/BONSO_TOOLS.png) Custom nodes for [ComfyUI](https://github.com/comfyanonymous/ComfyUI). | Node | What it does | | --- | --- | | **BonsoNet** | Five ControlNet preprocessors (Canny, Depth, OpenPose, Scribble, Anime Line Art) with a colour-coded banner and a resolution widget that hits the exact megapixel target. | | **Bonso Pose** | Manual OpenPose editor: place a mannequin over your reference image, drag the bones, export a ControlNet-ready PNG + `.json`, send it to any node. | | **Mask Crop Bonso** | Square mask crop that repositions instead of clamping at the image edges. | | **Easy Model Bonso** | Model inventory manager: scan the active workflow, download what is missing, save/load the inventory as JSON. | | **Bonso_FileName** | Builds a folder path out of up to **6** text boxes joined with `/`. Empty boxes are skipped; if all are empty it returns `Bonso`. | ## Nodes ### BonsoNet Preprocessor for ControlNet with 5 exclusive modes and a color-coded banner on the canvas: Canny, Depth (DepthAnything V1), OpenPose (DWPose), Scribble (XDoG) and Anime Line Art. The `Megapixel` widget (FLOAT) rescales the image proportionally to the exact megapixel target, so the returned map matches the requested resolution. Only `image` and `Megapixel` accept connections. Requires [`comfyui_controlnet_aux`](https://github.com/Fannovel16/comfyui_controlnet_aux) for the best quality detectors; falls back to native OpenCV/PIL processing for any detector that is unavailable. ### Bonso Pose ⛹🏻‍♂️ Manual OpenPose editor. No detection models — you place a T-pose mannequin and drag the bones over your reference image, tracing the limbs by eye. - **Visual box node**: the reference image is shown inside the node, on a black background, at whatever **opacity** you set — live, as you drag the slider. The preview keeps the reference's aspect ratio and starts **empty — black, with no skeleton** — so you place the mannequin only when you want it. - **Buttons**: `Cargar imagen` (load from file), `Editar pose` (open the drag editor), `Esqueleto` (drop the basic mannequin into the preview, over the black background or over the image), `Eliminar esqueleto` (clear it, so you can place another from scratch) and `ENVIAR A`. - **`Ancho de hueso`** is the bone thickness in pixels at 1 megapixel. It is drawn exactly like that in the preview, in the editor and in the exported pose. You can change it from the node or from inside the editor — both stay in sync. - **Connect an image node** to the `image` input and the box switches to it on its own, no reloading needed. If you change the picture in the `Load Image` above while the workflow is idle, the box follows **instantly**: the node polls its input every 400 ms (the trick `Outpaint Pixaroma` uses) because there is no event that announces a widget changed. - **The window adapts to the picture**: the reference box has a **fixed size in pixels**, derived only from its aspect ratio, and the node resizes itself to fit it plus the buttons. Reloading the tab therefore looks exactly the same as before — dragging the node wider no longer changes the image size. - **The node has a minimum size**: it cannot be shrunk past what the preview, the buttons and the settings need. - **Everything is written to `output\BONSO_POSES`** — `ENVIAR A` poses and the `.json`, plus the copies that `Cargar imagen` uploads. `Multi Image Reference` (Academia SD) can only read from `input`, so for that node a temporary copy is also placed there; the archived pose always stays in `output`. - **No wire outputs.** The result leaves the node only through **ENVIAR A**, which takes a target node name in a text row and hands the rendered pose to it. Works with `Load Image` and with `Multi Image Reference` (Academia SD), using the same convention as `AcademiaSD Image Save & Send`. - **Output keeps the reference image's aspect ratio**, scaled to the requested megapixels (default 1 MP). - **Manual posing**: drag any joint; right-click a joint to hide it (hiding a joint removes every segment attached to it). Pan with Space/Shift+drag, zoom with the wheel, F to fit, Ctrl+Z to undo. - **The editor is black past the picture.** Around the reference there is an infinite black canvas, so you can move a joint **outside** the frame — useful when the person is cropped at the waist. The dashed frame shows where the export will cut; the cropped result is exactly the picture's size. - Joints are **not labelled** any more: only the mannequin you place. - Renders in the exact format ControlNet's OpenPose model reads: black background, 60 %-brightness limbs, full-brightness joints, the standard 18 keypoints. - Also writes a ControlNet-compatible `.json` next to the PNG. - **Hands and face are not supported.** Body keypoints only. ### Mask Crop Bonso Square mask crop that repositions instead of clamping at image edges. Drop-in replacement for WAS Mask Crop Region. ### Easy Model Bonso Model inventory manager with download capabilities. Track your models, download missing ones, and save/load your inventory as a lightweight JSON file. - Scan the active workflow to list every referenced model, resolved against your local folders (subfolder-agnostic search, so a workflow pointing at `KREA\` will still find the file in `KREA2\`). - Auto-resolve download links from CivitAI and HuggingFace; the link field stays visible so you can paste one manually when no match is found. - Per-row status LED, background downloads with progress, drag to reorder, and export/import of the inventory as JSON. ### Bonso_FileName Builds a folder path out of plain words. One word per line, up to **6** lines (`Linea_1` … `Linea_6`): - **Añadir** (green) opens a new empty line below, **Eliminar** (pink) removes the last one. Both buttons always stay visible side by side at a fixed size (68×20) — when they cannot act (6 lines / 1 line) they just dim. - The node grows/shrinks with the lines; resizing the node does not change the button size. - The output is every non-empty line joined with `/`, ready to plug into any text input: `proyecto` + *(empty)* + `escena_01` → `proyecto/escena_01` Empty lines are ignored, and if every line is empty the node returns `Bonso`. No inputs, one `texto` output. ## Installation ```bash cd ComfyUI/custom_nodes git clone https://huggingface.co/OSOBONSO/comfyui_Bonso_Tools.git ``` Restart ComfyUI after cloning. The five nodes show up as **BonsoNet**, **Bonso Pose**, **Mask Crop Bonso**, **Easy Model Bonso** and **Bonso_FileName**. **Requirements**: ComfyUI. [`comfyui_controlnet_aux`](https://github.com/Fannovel16/comfyui_controlnet_aux) is optional — BonsoNet uses it for the best detectors and falls back to native OpenCV/PIL when it is missing. Version: see `pyproject.toml` (currently **1.4.4**). ## Contributing `BITACORA.md` is the handoff document for AI agents. It contains a mandatory protocol (single source of truth, verification rules, commit discipline) and the verified state of the package. Agents should read it before touching anything. ## License Apache 2.0