Nodes/DJZ-Nodes/Black Bars V3
ComfyUI Node

Black Bars V3

Padding to Any Aspect Ratio

By MushroomFleet·Created 2 years ago·Updated 5 months ago· 80
Black Bars V3
  • images
  • IMAGE
target_ratio
safe_areafalse
show_guidesfalse

If you've ever tried to fake a cinematic aspect ratio and lost half your image to a crop, you know the pain. Black Bars V3 solves it the boring, correct way: instead of cutting pixels away to hit a ratio, it pads the canvas and lets the extra space be black bars. Nothing gets cropped, ever. That's the whole pitch, and it's a good one.

This is the third generation of the same idea in the DJZ-Nodes pack, and the difference between V2 and V3 is exactly this - V3 always preserves the full frame. If you're letterboxing AI video or a batch of stills to look like film, that's what you want. Crop-based letterboxing is how you lose your subject's head.

How it works

The node takes your image batch, works out the current width-to-height ratio, and compares it to a target. If your image is wider than the target, it adds padding to the top and bottom (letterbox). If it's narrower, padding goes on the sides (pillarbox). The bars are pure black, the original pixels are untouched, and the result is a bigger canvas.

Two things make this friendlier than doing the math yourself. First, target_ratio can be set to auto, which detects the closest standard ratio from a lookup table of common resolutions (1920x1080 → 16:9, 720x480 → 4:3, and so on), falling back to nearest-ratio matching. Second, the ratio list includes the film ones people actually mean - 2.39:1 Anamorphic, 2.35:1 CinemaScope, 1.85:1 Theatrical - not just "widescreen, whatever that is."

The inputs that matter

You'll mostly set two things:

  • target_ratio - pick a ratio, or leave it on auto. The auto option guesses from your resolution, which is handy when you feed it mixed-size batches.
  • safe_area / show_guides - both off by default. Flip these on and it draws the broadcast 90% (action safe) and 80% (title safe) guide lines over the frame. That's for when you're actually prepping something for broadcast or a platform that guarantees safe zones, not for normal meme posting.

Output is a single IMAGE of the same batch, padded to the new canvas. Wire it into the same downstream nodes you already had - a VAE decode, a save node, a video combiner.

Installing it

Black Bars V3 ships in DJZ-Nodes, so install the whole pack once:

cd ComfyUI/custom_nodes
git clone https://github.com/MushroomFleet/DJZ-Nodes
cd DJZ-Nodes
pip install -r requirements.txt

Then restart ComfyUI. Or, easier for most people: open ComfyUI Manager, search "DJZ-Nodes", and install it there - the requirements get handled for you. The pack is a big utility drawer (75+ nodes), so you're pulling in a chunk of dependencies including OpenCV and scipy whether you use one node or all of them. That's the cost of one-stop shops; if you only want bars, you're still paying for the whole install.

Common issues

The one thing people trip on: this node pads, it doesn't shrink. A 1080p image set to 2.39:1 comes out as 1920x~800-ish with the top and bottom sliced off visually by bars - but the actual canvas is taller than your input. If you're compositing after this, downstream nodes expecting the original dimensions will complain or stretch. Feed the output straight to a save/video node and you're fine.

The other classic gotcha is batch mixing. auto detects per-frame, so a batch with different source resolutions gets inconsistent padding. When that happens, just pick an explicit ratio instead of trusting auto.

Categoryimage/format

Inputs (4)

NameTypeDefaultDescription
imagesIMAGE
target_ratioCOMBO8 options: auto, 2.39:1 (Anamorphic), 2.35:1 (CinemaScope), 1.85:1 (Theatrical), 16:9 (HD), 4:3 (Classic), +2
safe_areaBOOLEANfalse
show_guidesBOOLEANfalse

Outputs (1)

NameTypeDescription
IMAGEIMAGE