Nodes/ComfyUI-Apt_Preset/view_Reference Size
ComfyUI Node

view_Reference Size

Stop guessing how big your reference image should be

By cardenluo·Created 2 years ago·Updated about 15 hours ago· 334
view_Reference Size
  • image
  • video
  • image
  • video
input_typeminimax_match
generation_width1344
generation_height768

Reference-conditioned generation has a sizing problem nobody documents well. Drop a 4000×3000 photo into a video model's reference slot and you're feeding it pixels it will throw away, or latent tokens you'll pay for; drop in a 512×512 crop and identity or composition drifts because the model can't see enough. Every pipeline - MiniMax H3, Flux 2 Klein, Qwen Edit, SCAIL-2 - has its own convention for what a reference is supposed to look like.

view_Reference_Size (display name "view_Reference Size", note the space) is a small, unglamorous node that applies those conventions for you and then tells you the real numbers at the bottom of the node. No wires needed to see them; the widget just reports what it did.

The five modes

Pick input_type, tell it the size you're going to generate at, and it does the rest:

  • minimax_match - the H3 reference-image rule. It scales the reference down so its pixel area matches your generation canvas area, then rounds both dimensions to multiples of 32. It never scales up: a smaller reference stays the size it is. For video input in this mode it switches to the H3 reference-video canvas instead, which normalises the short edge to 768 and caps the total at 768×1344, again in 32-pixel steps.
  • minimax_max - the blunt upper bound: scale down until the short edge is 2048, leave the aspect ratio alone.
  • klein_image - Flux 2 Klein wants multiples of 16. This mode center-crops to the nearest 16-multiple rather than resizing, so the composition is preserved and the edges are trimmed. Cropping a subject out of frame is on you.
  • qwenEdit_image - Qwen Edit's reference handling is scale-to-cover then crop: the node scales the image up or down until it covers your generation size, center-crops to exactly that size, and then nudges it onto multiples of 8 for the VAE. This is the one mode that will upscale a small source.
  • scail2 - image references are resized to the full generation dimensions with bicubic; video references are resampled to half your generation size with area filtering, matching how SCAIL-2's pipeline feeds the driving material.

generation_width and generation_height default to 1344×768 - set them to what you're actually generating. The whole value of this node is that the reference is sized relative to the output; leave the defaults on a 1024×1024 run and you've just built a mismatch with extra steps.

Inputs and outputs

Input: input_type, generation_width, generation_height, and the optional image and video sockets. Output: image and video, same types you put in. The media outputs work on single frames internally and preserve your batch, and alpha channels are dropped - these are references, not compositing material, so the node works in RGB.

One behaviour to know so it doesn't look broken: whichever output you didn't feed is blocked, not empty. Feed only an image and the video output goes dark; feed only a video and the image output does. Wire through the one you're using.

When to reach for it

If you're doing reference-driven work - starting from a character photo, a product shot, or a driving video - and you're switching between models, this node saves you from maintaining a mental table of "H3 wants it like this, Klein wants it like that". It's also a decent sanity check the first time a reference-heavy workflow returns soft output: the node prints the size it actually produced, so you can see at a glance whether you handed the model an 8-megapixel image it downsampled to mush.

It is not a general-purpose resize node, and it's not an upscaler. It has no "match the target exactly at 2x" mode and no output-scale multiplier; for that, go to the pack's refine sampler or a plain image-scale node.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset
cd ComfyUI-Apt_Preset
pip install -r requirements.txt

Restart, and it's under Apt_Preset/PreView; ComfyUI Manager users can search Apt_Preset. There's no model to download and nothing else in the pack needs to be configured first - it's one of the few nodes here that works fine as your only Apt_Preset node. Fair warning on the docs: the pack is a Chinese-community project (Bilibili tutorials, Chinese tooltips), and this node's description is Chinese-only in the Python source, so the mode names are mostly self-documenting and the tooltip is the real reference.

CategoryApt_Preset/PreView

Inputs (5)

NameTypeDefaultDescription
input_typeCOMBOminimax_match图片:match 按生成画布像素面积等比缩小,max 按 2048 短边等比缩小;MiniMax 视频使用 H3 参考视频画布;Klein 居中裁到 16 倍数;Qwen Edit 按生成宽高中心覆盖裁剪并对齐到 8;SCAIL-2 图片使用完整生成尺寸,视频使用一半生成尺寸。
generation_widthINT134432–16384
generation_heightINT76832–16384
imageoptIMAGE
videooptVIDEO

Outputs (2)

NameTypeDescription
imageIMAGE
videoVIDEO