Nodes/ComfyUI-BarCensor/Bar Censor (Parallel Bars)
ComfyUI Node

Bar Censor (Parallel Bars)

Solid Bars Instead of Mosaic, and They Actually Stay Parallel

By InfinityTechnology·Created a day ago·Updated a day ago· 0
Bar Censor (Parallel Bars)
  • image
  • mask
  • image
  • censor_mask
  • info
◄bar_count1►
◄angle_mode▾►
◄angle0.0►
◄bar_orientation▾►
◄axis_offset0.0►
◄bar_shape▾►
◄thickness_mode▾►
◄thickness_ratio0.80►
◄bar_thickness24►
◄length_mode▾►
◄length_overflow8►
◄color▾►
◄custom_color#000000►
◄opacity1.00►
◄feather1►
◄invert_maskfalse►
◄region_expand4►

What this node is for

By now the "get a mask" half of ComfyUI is a solved problem - a YOLO detector, a SAM segmenter, a promptable masker, and a region is isolated in three nodes. What almost every tutorial does next is re-render it: detailers, inpainting, patch-and-paste. Bar Censor is for when you don't want to re-render. You want the region gone, the same way on every image in the batch and every frame of the clip.

Mosaic is what people reach for there, and mosaic looks like an artefact. Bars look like a decision - straight edges, sharp corners, one angle. If you've ever written bar censor into a negative prompt to stop a model making them, this is the same aesthetic on purpose, applied after the fact. Deterministic censorship.

Worth saying plainly: this pack has essentially no community footprint, so test it on a copy of your output rather than trust it blind.

How it works

The mask tells the node where. Everything else is geometry done in a rotated coordinate frame.

First it resolves an angle. With angle_mode = auto_rect (the default) it fits a minimum area rectangle to the mask contour with OpenCV and takes the long side, folding the result into −90°..90° because a bar direction is symmetric over half a turn. auto_pca does the same job from the mask's covariance eigenvector - cheaper, less shape-aware. The fixed modes and manual skip estimation.

Then the important part: bar #1 is laid down, and every other bar is generated by translating it along its own normal. They can't drift, because they're all the same bar, moved. The README measures the angle spread across bars at 0.000°, and reading the source that isn't marketing - the code builds a U/V grid where V is the normal direction and stamps bands at regular V intervals. Thickness in auto mode is period × thickness_ratio, so more bars means thinner bars and the same covered block.

The default bar_shape = rectangle draws that block as a rotated rectangle - straight edges, sharp corners, and the mask only decides position, angle and size. Switch to conform_mask if you want the bars clipped inside the mask silhouette instead.

The inputs you'll actually touch

  • mask (optional) - your detector's output. Leave it unconnected and the node stripes the entire image, which is genuinely useful as a full-frame overlay but usually a surprise.
  • bar_count - 1 to 32. At 1 it's a solid block over the region, no striping. For the classic manga look, 5–8.
  • angle_mode - leave it on auto_rect for stills; see the video warning below.
  • bar_orientation - along_axis (default) runs bars parallel to the region's long side. A standing person gives you vertical bars; across_axis gives horizontal ones.
  • thickness_ratio - 0.05–1.0, default 0.8, which is a lot of coverage. Drop to 0.4–0.6 for bars with visible gaps.
  • color / custom_color / opacity, and feather, which defaults to 1 - a one-pixel Gaussian soften. Set it to 0 for genuinely hard edges; the mask is blurred before compositing, so feathering also makes bar borders partly transparent.
  • region_expand (default 4) - grows the block in pixels. Handy when the detector mask is tight, which bounding-box detectors almost always are.

length_mode = full_image stretches bars edge to edge; fit_region keeps them inside the region span, with length_overflow padding both ends.

Three outputs: image with the bars burned in, censor_mask (the same coverage as a MASK, for reusing downstream), and info - a per-frame string like axis = 12.4 deg [auto_rect] + along_axis -> bar angle = 12.4 deg | bars = 6 | block = 180 x 340 px. Wire info into a text display node while tuning; it's the cheapest debugger in the pack.

Install

ComfyUI Manager: search ComfyUI-BarCensor and install. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/InfinityTechnology/ComfyUI-BarCensor.git

Restart ComfyUI. There's no requirements.txt and nothing to download - pyproject.toml lists numpy, and torch and OpenCV already ship with ComfyUI. No model files.

The node lives at 🧪AILab/▬BarCensor in the right-click menu, not under image or mask. That category name is inherited from the upstream project this pack is a companion to (1038lab's mosaic pack), so search the menu rather than browsing for it.

Where people get burned

Batch and mask frame counts must match. The node loops over image frames and indexes mask[i] for each, all inside a try/except that passes the original image through. A single-frame mask against a batch of thirty gives no error, no bars, and an info string reading failed, passthrough. If a video render silently does nothing, that's why.

Auto angle modes jitter on video. Per-frame rectangle fitting means the bar angle wobbles frame to frame, which reads as nervous jitter. The README says this outright: use manual or horizontal for anything with a time axis.

One mask, one block. Bar Censor treats the whole mask as a single region. Feed it a merged mask with three separate blobs and it builds one rotated block covering all three - gaps included. For two people, run two censor passes with separate masks, or accept the single rectangle.

Missing OpenCV degrades quietly. The cv2 import is wrapped in a try/except; without it, auto_rect silently becomes PCA and feather does nothing. If feather isn't changing anything, that's the trail.

Category🧪AILab/▬BarCensor

Inputs (19)

NameTypeDefaultDescription
imageIMAGE—
bar_countINT11–32—
angle_modeCOMBO7 options: auto_rect, auto_pca, horizontal, vertical, diagonal_down, diagonal_up, +1
angleFLOAT0.0-180–180—
bar_orientationCOMBO3 options: along_axis, across_axis, axis_plus_offset
axis_offsetFLOAT0.0-180–180—
bar_shapeCOMBO2 options: rectangle, conform_mask
thickness_modeCOMBO2 options: auto, manual
thickness_ratioFLOAT0.800.05–1—
bar_thicknessINT241–1024—
length_modeCOMBO2 options: fit_region, full_image
length_overflowINT80–512—
colorCOMBO4 options: black, white, gray, custom
custom_colorSTRING#000000—
opacityFLOAT1.000–1—
featherINT10–32—
maskoptMASK—
invert_maskoptBOOLEANfalse—
region_expandoptINT40–256—

Outputs (3)

NameTypeDescription
imageIMAGE—
censor_maskMASK—
infoSTRING—