ComfyUI-BarCensorRegions
Generate multiple bars from masked areas
ComfyUI-BarCensor
Censor a region with solid-color bars, or take the mask and do other things with it. You can feed in a manually drawn mask or the result of an automatic image recognition tool.
A fork of ComfyUI-BarCensor

Nodes
Menu: mask → ▬BarCensorRegions
BarCensorRegions — Bar Censor (Parallel Bars)
image + optional mask → image + censor_mask + info
| Parameter | Values | Meaning |
|---|---|---|
| bar_count | 1–32 | 1 = solid block; >1 = evenly spaced parallel bars. Reccomended to leave at 1. |
| region_mode | seperate_regions (default), whole_mask| Whether to generate multiple bars for each mask region, or one bar to cover all of the masked regions |
| min_region_area | 1 - inf | Minimum area of a masked region to be covered with a bar. Regions below this pixel size are ignored. |
| max_regions | 1 - inf | Maximum number of regions to generate. Decreasing this number does not merge regions, they will just be ignored if there are two many regions. |
| angle_mode | auto_pca (default), auto_rect, horizontal, vertical, diagonal_down, diagonal_up, manual | Source of the base angle. auto_rect fits a minimum area rectangle to the mask and uses its long side |
| angle | -180–180 | only used by manual (0 = horizontal, 90 = vertical) |
| bar_orientation | along_axis (default), across_axis, axis_plus_offset | bars along / across / offset from the region axis |
| axis_offset | -180–180 | offset used by axis_plus_offset |
| bar_shape | rectangle (default), conform_mask | straight-edged rotated rectangle, or follow the mask outline |
| thickness_mode | auto (default), manual | auto: thickness = period × ratio, rescales with bar_count |
| thickness_ratio | 0.05–1.0 | thickness / period (auto), or its upper bound (manual) |
| bar_thickness | px | fixed thickness for manual |
| length_mode | fit_region (default), full_image | bar length = region span, or span the whole image |
| length_overflow | px | extra length at both ends |
| color | black, white, gray, custom | bar color |
| custom_color | hex, e.g. #1a1a1a | used when color = custom |
| opacity | 0–1 | bar opacity |
| feather | px | edge softening (0 = hard, 1 ≈ anti-aliased) |
| mask (optional) | MASK | region to censor; without it the whole image is striped |
| invert_mask | bool | invert the mask |
| region_expand | px | grow the block (rectangle) or dilate the mask (conform_mask) |
Installation
cd ComfyUI/custom_nodes
git clone https://github.com/InfinityTechnology/ComfyUI-BarCensor-Regions.git
Restart ComfyUI. Dependencies (torch, numpy, opencv-python) ship with ComfyUI.
Tips
- BarCensorRegions treats seperate masked "areas" as different regions.
- If two areas in the mask touch, they will be considered as one region. Ensure separation between regions or run multiple time for closely spaced bars
License
GPL-3.0 — same as the upstream project.