Nodes/ComfyUI-DD-Nodes/DD Image Uniform Size
ComfyUI Node

DD Image Uniform Size

DD Image Uniform Size makes batches stop fighting you

By Dontdrunk·Created 2 years ago·Updated 21 days ago· 181
DD Image Uniform Size
  • 图片A
  • 图片B
  • 图片C
  • 图片D
  • 图片A
  • 图片B
  • 图片C
  • 图片D
缩放方法双线性插值
宽度512
高度512
尺寸适配自适应

The classic ComfyUI headache: you've got a ControlNet, an img2img pass, and a compositing step that all need to agree on dimensions, but your input images came in at three different sizes. DD Image Uniform Size is the blunt instrument for that problem - feed it up to four images, tell it one target width and height, and every image that's actually connected comes out the same size. It's part of the DD-Nodes pack, a Chinese-origin collection that mostly gets talked about for its UI animations, but the backend utility nodes like this one are the quietly useful half.

How it works

The node resizes each connected input to your target Width and Height using PyTorch's interpolate under the hood (the same machinery ComfyUI's core image nodes use). Two knobs decide how it gets there, and they're the part people get wrong:

  • Scaling method - nearest-exact, bilinear, area, bicubic, or lanczos. Bilinear is the safe default for photos. If you ever need to resize a mask with this node instead of its mask sibling, reach for nearest or area, because soft interpolation blurs mask edges.
  • Size fit - this is the real difference-maker:
    • Adaptive scales to fit inside the target while keeping the aspect ratio, then letterboxes the leftover with black. Nothing gets distorted, but you get black bars.
    • Stretch ignores aspect ratio entirely and squashes the image to exactly the target. Fast, and almost never what you want for humans.
    • Crop scales up until the image covers the target, then center-crops. Distortion-free, but you lose the edges.
    • Fill pads to the target with a center-fit (looks a lot like adaptive in practice).

Only inputs that have a wire on them produce an output, so if you hook up images A and C, outputs B and D stay empty - wire only what you need and the node quietly passes the rest through as unused sockets.

When you'd actually reach for it

Batch consistency is the main event. If you're doing batch img2img where every frame needs to reach a sampler at the same resolution, or you're feeding a ControlNet preprocessor that expects a specific size, run everything through this node first and stop chasing mismatch errors. It's also handy right before VAE encode for inpainting workflows, where the mask and the image have to line up pixel-for-pixel. Just remember the letterbox: in Adaptive mode the black bars are part of the image, so if you're sending to a VAE you're paying for the full target resolution anyway - that's the point of the mode.

Installation

The pack installs like any other custom node:

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

Then restart ComfyUI. Easier: ComfyUI Manager → Install Custom Nodes → search "ComfyUI-DD-Nodes". No model downloads come with it; the requirements are just the usual numpy, torch, opencv-python, pillow stack (plus a few heavier ones like moviepy and transformers that the pack pulls in for other nodes).

Where people get burned

The most common surprise is expecting Adaptive to stretch. It doesn't - it letterboxes, and the black bars are deliberate. If you see a black border you didn't want, you set the fit mode wrong, not the node. And note the node's UI labels are Chinese by default (the whole pack is bilingual - switch to English in ComfyUI's settings under the language option if you prefer). One more thing: this is the image version; if you're sizing masks to match a resized image, grab the DD-MaskUniformSize sibling from the same pack so your mask and image take the identical path.

Category🍺DD系列节点

Inputs (8)

NameTypeDefaultDescription
缩放方法COMBO双线性插值5 options: 邻近-精确, 双线性插值, 区域, 双三次插值, lanczos
宽度INT5128–8192
高度INT5128–8192
尺寸适配COMBO自适应4 options: 自适应, 拉伸, 裁剪, 填充
图片AoptIMAGE
图片BoptIMAGE
图片CoptIMAGE
图片DoptIMAGE

Outputs (4)

NameTypeDescription
图片AIMAGE
图片BIMAGE
图片CIMAGE
图片DIMAGE