Nodes/CMK Flow/CMK Flow · Image Resize
ComfyUI Node

CMK Flow · Image Resize

Change the pixel count without waking a model

By CMKFlow·Created 4 months ago·Updated 5 days ago· 6
CMK Flow · Image Resize
  • PROCESS
  • IMAGE
  • LOG
  • MODEL (opt)
  • VISUAL
  • MODEL
  • PROCESS
  • IMAGE
  • LOG
  • VISUAL
  • diagnostic
◄SCALE ENABLEtrue►
◄scale_methodScale to Max Dimension►
◄interpolationlanczos►
◄largest_size1600►
◄megapixels4.00►
◄target_width512►
◄target_height512►
◄padding_colorblack►

You have a 2048px render and you need it at 1600. Or you're about to hand a soft 4MP image to an upscaler that wants something smaller going in. Neither job needs a model. CMK Flow · Image Resize is the plain interpolator in the CMK pack - pixels get rearranged, nothing gets invented, it runs in milliseconds.

That's the point, not a limitation. And the upscaling crowd has come back around on interpolators: Lanczos shows up in more 2026 threads than any single ESRGAN model, because when the source is already sharp you want pixels and nothing else.

How it works

Under the hood it's comfy.utils.common_upscale - the same resampler ComfyUI's own ImageScale nodes call - with cropping disabled, so nothing gets trimmed. scale_method picks exactly one of three behaviours, and the settings belonging to the other two are never read:

Scale to Max Dimension (default) takes largest_size, default 1600, and fits the longest edge to it, scaling the other side proportionally. Aspect ratio survives.

Scale to Megapixels takes megapixels, default 4.0, and scales by sqrt(target_pixels / actual_pixels), counting a megapixel as 1024×1024. Use it when a downstream model cares about pixel budget rather than an edge length.

Resize and Pad fits the image into target_width × target_height (512 × 512 out of the box) using the smaller of the two scale factors, centres it, and fills the remainder with padding_color - black or white. No stretching, no cropping, a letterbox.

interpolation defaults to lanczos and offers area, bilinear, bicubic and nearest-exact. Downscaling? Use area - a box filter, it averages instead of ringing, and it's what the community advice about dropping an image to ~0.35MP before a generative upscale assumes you're doing. Upscaling a photo, stay on lanczos. nearest-exact is for pixel art; on photographs it looks like gravel.

Inputs and outputs

PROCESS, IMAGE and LOG are required - this is a CMK module, so it speaks the pipe protocol. MODEL (opt) and VISUAL are optional.

Out comes MODEL, PROCESS, IMAGE, LOG, VISUAL and diagnostic. MODEL and PROCESS pass through completely untouched - that's why you can drop this into the middle of a live chain instead of bolting it on the end. Put it after the PostProcess Boundary and before Upscale & Save or the Visualizer, per the pack's own placement note. Leave MODEL (opt) unwired and the MODEL output is just empty; nothing breaks.

LOG gains an Image Resize block (method, input size, output size, interpolation), VISUAL gets a before/after entry the Visualizer picks up, and diagnostic previews source and result side by side.

The node also caches its result at the module boundary in ComfyUI/temp/cmk/, printing HIT or MISS -> STORED. The fingerprint excludes the inactive method's settings and the transport wires, so switching scale_method re-runs, while fiddling with megapixels on Max Dimension does nothing. A restart empties the cache.

Installing it

The pack is new and small, so start with Manager: search CMK Flow, install the entry from CMKFlow (registry package name cmk-flow), restart.

Manual, from your ComfyUI root - the folder with main.py in it:

git clone https://github.com/CMKFlow/cmk_nodes.git custom_nodes/cmk_nodes
python3 custom_nodes/cmk_nodes/scripts/install_cmk_requirements.py

You want CMK dependency check: OK at the end. That second command isn't optional: a manual git clone never runs pip on its own, and the helper works out which Python ComfyUI is actually using - which matters on Desktop installs, where system Python, standalone-env and ComfyUI/.venv coexist. Coming from an older CMK version, back up or remove the old folder rather than layering on top.

Be warned: requirements.txt is a hefty pile - ultralytics, insightface, onnxruntime, segment-anything, imageio-ffmpeg, nudenet, opencv. None of it is for this node, which is model-free and needs nothing beyond ComfyUI, torch and numpy. The resource check (scripts/check_cmk_resources.py --models-root "…") is likewise for the other CMK nodes.

Where people get burned

Turn on Vue Nodes / Nodes 2.0. CMK requires the new frontend (tested against ComfyUI 0.38.2 with frontend 1.53.6). Without it, dynamic CMK nodes fall back to the legacy LiteGraph renderer - no Advanced toggle, no proper dropdowns. This node's whole settings block is flagged advanced in the source, so that toggle is where your largest_size and padding_color live. Unusual direction for a pack: most authors are porting to Nodes 2.0 or refusing outright, not requiring it.

"Scale to Max Dimension" upscales too. It fits the longest edge to largest_size - it doesn't cap it. Load a 512px image with the default 1600 and you get a 1600px image with no new detail in it. If you meant "downscale if large, otherwise leave alone", set SCALE ENABLE to false instead, a true passthrough that writes no cache entry.

Padding is literal. black is 0.0 and white is 1.0 on the tensor. On a dark photo, white padding is a hard white frame.

Feeding a second diffusion pass? Don't blindly set 1600 and go. SDXL's trained ratios are discrete - 1024×1024, 1152×896, 1216×832, 1344×768, 1536×640 and their rotations. If a resize is the last thing before another sample, Scale to Megapixels around 1.0 or a padded trained ratio keeps you where the model is happy.

Last caveat: the pack went open source in July 2026 and the community signal is thin - a handful of posts, mostly from the author, and German-first docs. Fortunately for a resize node, the source is 400 lines.

CategoryCMK/Flow/PostProcess

Inputs (13)

NameTypeDefaultDescription
PROCESSCMK_RESULT_PROCESS,CMK_MASK_DETAILER_PROCESS—
IMAGEIMAGE—
LOGCMK_LOG_PIPE—
SCALE ENABLEBOOLEANtrue—
scale_methodCOMBOScale to Max Dimension3 options: Scale to Max Dimension, Scale to Megapixels, Resize and Pad
interpolationCOMBOlanczos5 options: area, lanczos, bilinear, nearest-exact, bicubic
largest_sizeoptINT16001–16384—
megapixelsoptFLOAT4.000.01–16—
target_widthoptINT5121–16384—
target_heightoptINT5121–16384—
padding_coloroptCOMBOblack2 options: black, white
MODEL (opt)optCMK_MODEL_PIPE—
VISUALoptCMK_VISUAL_PIPE—

Outputs (6)

NameTypeDescription
MODELCMK_MODEL_PIPE—
PROCESSCMK_RESULT_PROCESS—
IMAGEIMAGE—
LOGCMK_LOG_PIPE—
VISUALCMK_VISUAL_PIPE—
diagnosticCMK_DIAGNOSTIC—