Nodes/ZF-ComfyUI-Helper/ZF 简易尺寸(图像)
ComfyUI Node

ZF 简易尺寸(图像)

Resize an image and its mask together, with model-neutral presets

By Z-yaofang·Created 2 months ago·Updated 19 days ago· 1
ZF 简易尺寸(图像)
  • image
  • mask
  • image
  • mask
  • width
  • height
  • summary
size_modepreset
preset方图/1024x1024 (1:1)
width1024
height1024
target_length1024
crop_methodcenter_crop
resize_algorithmlanczos

Every workflow that starts from a real image eventually needs it resized to a model-friendly resolution - and if there's a mask in the picture, the mask has to resize with it or your inpainting is silently misaligned. ZFEasySizeImage (display name "ZF 简易尺寸(图像)", which reads as "easy size (image)") does both in one node: it takes an optional image and an optional mask, resizes them to the same target, and hands back clean dimensions plus a human-readable summary.

It's part of ZF-ComfyUI-Helper, a small dependency-free utility pack, and it sits under ZF Helper/Size.

The presets are the selling point

The preset list is built from the classic resolution tables of a bunch of model families - SD1.5, SDXL, FLUX, WAN, and QWEN all contribute - but then the duplicates are removed and what's left is regrouped into landscape, portrait, and square submenus, ordered by pixel area. So instead of a flat wall of "FLUX 1344x768" and "SDXL 1216x832," you get a clean "landscape → 1024x576" picker that works no matter what model you're actually running. The author's framing is that the dimensions are model-neutral: the downstream model still decides what pixel range and latent format it supports, this node just stops you from hand-typing resolutions.

Every preset dimension is a multiple of 8, which matters - video and latent models in particular get unhappy with resolutions that don't land on their tile boundaries.

The modes you'll actually set

Four inputs do the real work:

  • size_mode - preset (pick from the list), custom (use width/height), longest_side, or shortest_side (keep the image's aspect ratio and set the target side to target_length).
  • crop_method - center_crop fills the target size and crops from the middle; stretch just squishes to fit. Center-crop is what you want for most pipelines; stretch only when aspect distortion is acceptable.
  • resize_algorithm - lanczos (default, best quality for downscaling), bilinear, or nearest. Leave it on lanczos unless you're doing something pixel-art-y.
  • width / height / target_length - used depending on mode.

The resize happens through PIL under the hood, so it's fast and reliable on batches too - the node resizes every frame in an image batch to the same target.

Outputs

Five of them: image and mask (the resized pair, ready for anything that consumes images), width and height (the final dimensions - wire these to a size node or an empty latent), and summary, a string like 1024x576 | 16:9 | mode=preset | … you can pipe into a text display to see at a glance what happened. If you only connect an image (no mask), you get the image resized and a placeholder mask - the node doesn't require both.

Installing it

Trivially - the pack has zero external dependencies:

cd ComfyUI/custom_nodes
git clone https://github.com/Z-yaofang/ZF-ComfyUI-Helper

Restart ComfyUI, or search ZF-ComfyUI-Helper in ComfyUI Manager. No models, no requirements.txt.

Where it earns its keep - and its limit

The single best use is image-to-video and image-to-image pipelines where you need the input image, its mask, and the size settings all consistent at once. The limit is equally honest: this node resizes pixels. It does not create a latent, and it can't fix the common beginner mistake of resizing the image but feeding the sampler a latent built from the original dimensions. When that mismatch happens, the fix isn't here - it's making sure the size numbers that feed your empty-latent node match what this node output. That's exactly why the sibling node ZFEasySizeSettings exists: for pure number-out, no pixels.

CategoryZF Helper/Size

Inputs (9)

NameTypeDefaultDescription
size_modeCOMBOpreset4 options: preset, custom, longest_side, shortest_side
presetCOMBO方图/1024x1024 (1:1)45 options: 横图/640x480 (4:3), 横图/768x512 (3:2), 横图/832x480 (16:9), 横图/768x576 (4:3), 横图/896x512 (7:4), 横图/1024x576 (16:9), +39
widthINT102464–8192
heightINT102464–8192
target_lengthINT102464–8192Used by longest_side and shortest_side modes.
crop_methodCOMBOcenter_crop2 options: center_crop, stretch
resize_algorithmCOMBOlanczos3 options: lanczos, bilinear, nearest
imageoptIMAGE
maskoptMASK

Outputs (5)

NameTypeDescription
imageIMAGE
maskMASK
widthINT
heightINT
summarySTRING