BBox Editor ✏️
Fix a Bad Crop Box Without Re-running the Detector
- bbox_data
- bbox_data
- info
Detection nodes get bounding boxes wrong all the time - they clip a pixel off the edge, they include the shadow, they land a few points too high. Re-running the detector usually gives you the same wrong answer. BBox Editor is the manual override: it takes a bounding box from TextureAlchemy's inpainting-crop nodes and lets you nudge any of its values by hand before the box gets used.
It's part of the inpainting side of amtarr/ComfyUI-TextureAlchemy - the pack's whole seamless-texture flow depends on cropping a region, fixing it with inpainting, and pasting it back. The crop nodes (InpaintCropExtractor and friends in the same pack) emit a BBOX_DATA object describing the region plus the original canvas size. BBoxEditor is the "fine-tune the box" step between detection and crop.
How it works
The node takes the incoming bbox_data (x, y, width, height, plus the original canvas dimensions) and overwrites whichever fields you tell it to. The catch is the convention: -1 means "leave it alone." Every override field defaults to -1, so if you only care about the X position, you set override_x to your new value and leave the rest untouched - the node passes the originals through.
The inputs that matter
bbox_data- the bounding box from one of the pack's crop/detect nodes. You can't feed this arbitrary numbers; it's a pack-internal type that only those nodes produce.override_x,override_y- reposition the box's top-left corner (default -1 = keep).override_width,override_height- resize the box.override_original_width,override_original_height- override the canvas size the box was computed against. Handy when the source resolution changed between detection and now and the box is now out of range.
Outputs are the edited bbox_data (wire it back into the crop node) and info, a STRING that lists what changed - useful if you're feeding it to a Show Text node to debug.
Where it slots in
The flow looks like this: generate a mask → InpaintCropExtractor gives you a cropped region + its bbox_data → BBox Editor to correct a slightly-too-tight crop → inpaint the region → paste it back using the corrected box. When the detector keeps grabbing the seam between two tiles, this node is the least annoying fix in the pack.
Installing it
Same pack, same install:
cd ComfyUI/custom_nodes
git clone https://github.com/amtarr/ComfyUI-TextureAlchemy
restart, and it's under Texture Alchemist → Inpainting. ComfyUI Manager search term: "Texture Alchemy". No extra dependencies.
Gotchas
The -1 = keep original convention is the thing that'll bite you if you assume 0 is "no change" - setting override_x to 0 genuinely moves the box to x=0, it doesn't reset it. Also remember the original canvas dimensions are part of the data: if you resized the source image between the crop node and here, the coordinates can silently drift out of bounds, and that's exactly what the two original_* overrides are for. And no, it won't clamp values for you - a box that runs past the edge stays past the edge.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| bbox_data | BBOX_DATA | — | |
| override_x | INT | -1-1–10000 | Override X position (-1 = keep original) |
| override_y | INT | -1-1–10000 | Override Y position (-1 = keep original) |
| override_width | INT | -1-1–10000 | Override width (-1 = keep original) |
| override_height | INT | -1-1–10000 | Override height (-1 = keep original) |
| override_original_width | INT | -1-1–10000 | Override original canvas width (-1 = keep original) |
| override_original_height | INT | -1-1–10000 | Override original canvas height (-1 = keep original) |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| bbox_data | BBOX_DATA | — |
| info | STRING | — |