Ideogram 4 Bounding Box Crop
Crop to a box, get the Ideogram coordinates too
- image
- bboxes
- image
- IG4 Box
- Box
Ideogram 4 is a weird model in the best way: it doesn't take your prompt as prose, it takes a structured JSON caption with hex color palettes and bounding boxes - boxes that can overlap, nest, and carry their own colors. If you've ever drawn a box on a canvas, cropped out that region to feed it back as conditioning, and then had to convert the crop coordinates into Ideogram's [y_min, x_min, y_max, x_max] thousandths format by hand, this node saves you the arithmetic.
UC_Ideogram4BoundingBoxCrop crops an image to a selected bounding box and returns three things: the crop, the clamped pixel-space box, and the same box reformatted the way Ideogram 4's caption schema expects. It exists for the "detect a region, crop it, prompt it separately" loop that regional workflows are built from.
How it works
You hand it an image and a BOUNDING_BOX (from a box-drawing node or the pack's ExtractBoundingBox). The index input picks which box to use when your bbox socket carries a list. It clamps the box to the image bounds - so a box that hangs off the edge gets trimmed, not error-crashed - and raises only if the clamped box has no area left. Then it crops, and computes the Ideogram-normalized coordinates as (top/height*1000, left/width*1000, bottom/height*1000, right/width*1000), which is exactly the [y_min, x_min, y_max, x_max] format Ideogram 4's JSON captions want.
The outputs that matter
image- the pixel crop, ready to VAE-encode or feed a VLM.IG4 Box- the string, e.g.[125,220,500,640], formatted to drop straight into an Ideogram 4 caption.Box- the clampedBOUNDING_BOXin ordinary pixel coordinates, if you need the honest geometry downstream.
The bboxes input is required and forced as a wire (BOUNDING_BOX), and index defaults to 0. Note it insists on exactly one input image - batch input is rejected with a clear error, so feed it a single frame.
Installing it
ComfyUI Manager → search "ComfyUI-UtilsCollection", or:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
Restart. Pack dependencies are light (opencv-python, typing-extensions), no model files, no API key - the "Ideogram" in the name is about the model's caption format, not a call to Ideogram's servers. Newer-API pack, so keep ComfyUI updated.
The trap to watch: don't feed a batch. It wants one image at a time, and the error message doesn't hedge. And remember the IG4 Box string uses thousandths (0–1000), not percentages - pasting it into a caption that expects 0–1 floats will silently misplace the box.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| bboxes | BOUNDING_BOX | [object Object] | — |
| index | INT | 00–9223372036854776000 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| IG4 Box | STRING | — |
| Box | BOUNDING_BOX | — |