Nodes/ComfyUI_StringOps/重置图像🐠meeeyo.com
ComfyUI Node

重置图像🐠meeeyo.com

One node to resize any image to a sane, model-friendly size — and hand you back width and height

By MeeeyoAI·Created 2 years ago·Updated about a year ago· 209
重置图像🐠meeeyo.com
  • image
  • mask
  • image
  • mask
  • width
  • height
max_dimension0
size_optionMillion Pixels

Every video or image workflow has the same moment: your input image is 1373×912 or some other uncooperative size, and the model wants 832×480 or a dimension divisible by 8. You could chain a ResizeImage plus a Math node and compute the right value by hand. Or you could use ImageAdjuster (重置图像 - "reset/adjust image"), which resizes the image and your mask together, and hands you back the resulting width and height as INT outputs so your sampler knows what it's dealing with. That last part is the bit that makes it worth a look.

How it works

Inputs: image (an IMAGE), mask (a MASK), max_dimension, and a size_option dropdown. Two things about those inputs that trip people up immediately:

  • mask is required. There's no "leave it empty" path - you must wire a mask in. It resizes the mask in lockstep with the image. If you don't have a real mask, a solid-white MASK (from something like a solid-mask generator) works as a dummy, since it stays white through resizing.
  • max_dimension only matters in Custom mode. This is the trap. Default size_option is Million Pixels, where max_dimension is ignored. In Custom mode, max_dimension caps the longest side - but if you leave it at the default 0 while in Custom, the resize ratio collapses to zero and you get a degenerate image. Set a real value (512, 768, 1024…) for Custom.

The size_option dropdown is the star: Custom, Million Pixels, Small, Medium, Large, then a row of video-oriented presets - 480P-H(vid 4:3), 480P-V(vid 3:4), 720P-H(vid 16:9), 720P-V(vid 9:16), 832×480, and 480×832. Small/Medium/Large pick from a fixed set based on aspect ratio (portrait vs landscape vs square), and Million Pixels targets roughly a 1-megapixel area with the longest dimension snapped to a multiple of 8 - the "latent-friendly" sizes video models actually like. Resizing uses center-crop (ImageOps.fit), so it fills the target frame rather than squishing.

Outputs: image, mask (both resized), plus width and height as INT.

Why you'd reach for it

It's the pack's answer to "make my image fit the model," aimed squarely at video pipelines - the 480P/720P and 832×480 presets are Wan/AnimateDiff-style sizes. Wire your loaded image + a mask, pick a preset, and both the pixels and the mask stay consistent while the sampler gets exact dimensions.

Install

Part of ComfyUI_StringOps:

cd ComfyUI/custom_nodes
git clone https://github.com/MeeeyoAI/ComfyUI_StringOps.git

Restart. Or ComfyUI Manager → "ComfyUI_StringOps". No models; standard deps (Pillow, torch, numpy). Chinese UI (重置图像) with the 🐠meeeyo.com branding.

Common issues

The max_dimension = 0 in Custom mode is the #1 way people break this - set it, or use a preset. Second: it's center-crop, so you will lose the edges; if your composition's subject lives on the border, crop it yourself first. And third, the width/height outputs always reflect the first image of a batch even if images differ - fine for single-image work, be careful with mixed-size batches.

Strong utility, generous preset list, and the mask-pass-through makes it genuinely convenient for img2vid. Just don't forget the mask wire.

CategoryMeeeyo/File

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
maskMASK
max_dimensionINT00–4096
size_optionCOMBOMillion Pixels11 options: Custom, Million Pixels, Small, Medium, Large, 480P-H(vid 4:3), +5

Outputs (4)

NameTypeDescription
imageIMAGE
maskMASK
widthINT
heightINT