ImageDrawRectangleByContainer
Allor's ByContainer trick
- container
- IMAGE
Every once in a while you need a rectangle that is exactly the size of another image - a border to composite over a render, a frame for a caption area, a hitbox-shaped guide. That's what the "ByContainer" in this node's name means: instead of typing a width and height, you feed it a reference image (the "container") and the canvas inherits that image's dimensions. It's part of the Allor plugin, an image-processing pack from Nourepide that's basically a WAS-Node-Suite-style toolkit built to stay in tensor space.
How it works
The node draws onto a transparent RGBA canvas sized to your container image, using PIL's ImageDraw under the hood. The coordinates are normalized - start_x, start_y, end_x, end_y are all fractions of the canvas, 0 to 1, so the same values produce a proportionally identical rectangle whether your container is 512×512 or 2048×1152. Defaults are a box from (0.1, 0.2) to (0.9, 0.8), i.e. most of the frame with a bit of margin.
Where this node earns its keep is anti-aliasing. The SSAA input (default 4) renders the rectangle at 4× the final resolution, then downsamples with your chosen method (lanczos, bicubic, hamming, bilinear, box, or nearest). That's the difference between a jagged developer-art square and edges that composite cleanly. Turn SSAA down to 1 if you want speed or a deliberately hard pixel edge.
Inputs that matter
container- any IMAGE; its size becomes the canvas size.start_x/start_y/end_x/end_y- rectangle bounds as 0–1 fractions. Defaults put the box inside the frame, not flush with it.fill_red/green/blue+fill_alpha, andoutline_red/green/blue+outline_alpha- the fill and stroke colors. Alpha is 0–1, colors 0–255. Setoutline_sizeto 0 for no border.SSAAandmethod- the anti-aliasing quality knobs above.
It returns a single IMAGE. Note it's an RGBA image: the area outside your rectangle is transparent, so wire it into a composite/overlay step rather than expecting it to replace a background. Pair it with an alpha composite node to drop the box over a render.
Installing it
Allor is one pack covering ~90 nodes, so you install it once:
cd ComfyUI/custom_nodes
git clone https://github.com/Nourepide/ComfyUI-Allor
Then restart ComfyUI. ComfyUI Manager works too - search for Allor Plugin. First launch creates a config.json in the plugin folder and installs the pack's dependencies (rembg, onnx), which is a chunky first-start; the draw/effects/filter nodes themselves need no model downloads.
Gotchas
- The repo was rebased to strip old images from git history (roughly 344× smaller). If you cloned an old copy,
git pullcan fail - the README links to update troubleshooting docs, and a clean re-clone fixes it. - Coordinates are fractions, not pixels. It feels weird the first time you type 0.9 instead of 900, but it means one workflow works at any resolution.
- Don't forget the output is transparent outside the rectangle; if you save it directly you get a box floating on black-and-white checkerboard, not a card.
If you don't need the container sizing and just want a rectangle on a fresh canvas, the plain ImageDrawRectangle node takes width/height inputs instead.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| container | IMAGE | — | |
| start_x | FLOAT | 0.10 | — |
| start_y | FLOAT | 0.20 | — |
| end_x | FLOAT | 0.90 | — |
| end_y | FLOAT | 0.80 | — |
| outline_size | INT | 1 | — |
| outline_red | INT | 0 | — |
| outline_green | INT | 0 | — |
| outline_blue | INT | 0 | — |
| outline_alpha | FLOAT | 1.00 | — |
| fill_red | INT | 255 | — |
| fill_green | INT | 255 | — |
| fill_blue | INT | 255 | — |
| fill_alpha | FLOAT | 1.00 | — |
| SSAA | INT | 41–16 | — |
| method | COMBO | 6 options: lanczos, bicubic, hamming, bilinear, box, nearest |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |