abyz22_makecircles
Sprinkle random holes and keep only what's inside them
- image(mask)
- image
Some inpainting tasks want a scattered mask - a bunch of disconnected holes rather than one blob. That's what abyz22_makecircles is for: it drops random filled ellipses across the frame and ANDs your input image against them, so the output keeps only the pixels inside those circles. Feed the result to an inpaint as a mask and you get dozens of small random regions to regenerate at once, which is a fast way to test how well a model repairs texture without hand-drawing anything.
It ships in abyz22/image_control, the Impact Pack fork. The node is pure OpenCV geometry - random ellipse placement plus a bitwise AND. No model, no sampling, instant.
Inputs
image(mask)- an IMAGE to punch holes into. Despite the name it doesn't have to be a mask; it can be any image you want to carve.amount(0–200, default 100) - how many ellipses to place.r_x,r_y(0–30, default 10) - the ellipse radii in pixels, which set the hole size. 10 is small; crank both toward 30 for big gaps.
Output is one image - your input with everything outside the ellipses zeroed out to black.
How it works
The code builds a black canvas the size of your image, uses numpy random uniform to pick amount ellipse centers, draws filled ellipses in white with cv2.ellipse, then does torch.bitwise_and between your image and the ellipse mask. So the white areas are where the original survives; everything else is black. That's also the thing to know for wiring: the output is an IMAGE (white-on-black), not a MASK type. To use it as an inpainting mask, run it through a converter or feed it where an IMAGE mask is accepted - this pack's abyz22_lamaInpaint takes a mask_(img) IMAGE input, which pairs up neatly.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/abyz22/image_control
or ComfyUI Manager → "image_control", restart. The pack's install pulls openpyxl, pytorch-lightning, kornia.
Where it bites
Ellipse centers are chosen with np.random.uniform over the full frame with no seed control - the node ignores any seed, so you can't reproduce a specific hole pattern. If reproducibility matters, generate your mask once, save it, and reuse the saved image. Also, amount at 100 with small radii covers a lot of scattered area; with a big batch or a busy workflow that's a lot of latent area to regenerate, so start around 20–40 and raise it. The typical combo in this pack's world: makecircles → blend or inpaint → abyz22_blendimages to composite the repaired result back over the original. For a less geometric, more organic scattered mask, abyz22_RandomMask in the same pack is the alternate route.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image(mask) | IMAGE | — | |
| amount | INT | 1000–200 | — |
| r_x | INT | 100–30 | — |
| r_y | INT | 100–30 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |