CMK Load Image
Aspect-Preserving Crop, and Why Your Image Isn't Distorted
- MODEL SDXL (opt)
- MODEL
- PROCESS
- IMAGE
- LOG
- diagnostic
- MASK
- image_file
The stock LoadImage node has one behaviour that quietly ruins a lot of workflows: resize it to a target and it will stretch your source to fit. A face reference gets squashed into a 1152×832 box, the identity embedding is computed from a warped face, and you spend an hour wondering why the likeness is off. CMK Load Image takes the other approach, and it's the right one.
Crop, don't squash
It picks the target resolution first, then crops the source to that aspect ratio before resizing. Nothing is distorted, ever.
CROP defaults on and CROP POSITION picks which part of the frame survives: center, top, bottom, left, right. The anchoring is sensible about irrelevance - left and right only apply when the crop is actually horizontal, top and bottom only when it's vertical, and the other axis falls back to centred. So "top" on a portrait that needs a horizontal crop means "centred horizontally, keep the top", which is what you'd have chosen anyway.
The crop box is computed to stay inside the source image, so you never get transparent edges or out-of-range resampling. RESIZE METHOD is lanczos (default), bicubic, bilinear or nearest - for photos, leave it on lanczos; nearest is for pixel art and masks.
RESOLUTION is a preset list of 20 sizes, SDXL-shaped and otherwise, defaulting to SDXL 1152x832. SWAP DIMENSIONS flips the preset's width and height, which is the fast way to go from landscape to portrait framing without hunting for the matching entry.
The bits that make it more than a loader
The mask editor actually works. If you paint a mask on the image in ComfyUI's native editor, this node finds the authoritative source rather than the composited preview - the clipspace mask file carries the untouched RGB and the exact alpha, while the "painted-masked" variant has the overlay baked into its pixels. It then runs the mask through the same crop and resize as the image, so mask and pixels stay aligned. You get the result back both in PROCESS and as a MASK output.
Alpha is the mask. When the loaded file has an alpha channel, the mask is derived from it (1.0 - alpha). So a PNG with transparency arrives with a mask already - no painting required.
It tells the pipeline whether you're inpainting. The process pipe records boolean_inpaint_mode, set from whether the resized mask contains anything non-zero. Downstream CMK modules use that to decide if they need an image at all, which is why a pure text-to-image run doesn't pull wires it doesn't need.
It's the source, not the recipe. The docstring is direct about this: no prompt, no LoRA, no latent preparation. It gives you pixels and the metadata around them and nothing else.
Inputs and outputs
Required: image (the dropdown, with upload enabled - your input/ folder plus the pack's packaged reference images), RESOLUTION, SWAP DIMENSIONS, RESIZE METHOD, CROP, CROP POSITION.
Optional: MODEL SDXL (opt), a CMK_MODEL_PIPE that passes through unchanged as the ordinary MODEL output. If you don't connect one, no placeholder is invented - pixel-only modules just use PROCESS, IMAGE and LOG.
Outputs: MODEL, PROCESS (CMK_RESULT_PROCESS, family-neutral, carrying source/target/crop metadata for downstream Prepare nodes), IMAGE, LOG, diagnostic, MASK, and image_file - a ComfyUI file reference, so identity modules can consume the same source through one visible wire instead of a second decode.
That PROCESS output is the reason for the Pipe in the class name: it's the standalone entry point for pixel-based CMK post-processing modules, not just a loader.
Install
Manager: search CMK Flow, install the CMKFlow entry, restart. Manual, from your ComfyUI root:
git clone https://github.com/CMKFlow/cmk_nodes.git custom_nodes/cmk_nodes
python3 custom_nodes/cmk_nodes/scripts/install_cmk_requirements.py
python3 custom_nodes/cmk_nodes/scripts/check_cmk_resources.py --models-root "/path/to/ComfyUI-Shared"
The resource step matters here because this node is usually the input to something that needs weights - a ControlNet, an InstantID, a face module. The pack's weights are never in the Python package; the checker reports each one as FOUND or MISSING and can fetch the ones with a verified public source. Do connect ComfyUI's Nodes 2.0 / Vue setting too; CMK warns at startup without it.
Where people get burned
Crop surprises. A tight crop on a tall source can cut off the part you cared about. Preview before you trust - that's what the diagnostic payload is for.
Expecting the drop-down to see everything. It lists input/. Not output/, not arbitrary folders. (There's a separate loader for video, and its videos live in input/video/.)
Reach for the plain LoadImage when you want a literal resize. The crop is the feature, but sometimes you actually want a stretched fit - for a mask or a ControlNet hint, say. This node will not do that for you.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | COMBO | 13 options: CMK Package · clipspace-mask-1792499379891.png, CMK Package · face_reference.png, CMK Package · controlnet_reference.png, CMK Package · detailer_reference.png, CMK Package · face_identity_reference.png, CMK Package · faceswap_reference.png, +7 | |
| RESOLUTION | COMBO | SDXL 1152x832 | 20 options: 1024x1024, 1152x832, 832x1152, 1216x832, 832x1216, 1344x768, +14 |
| SWAP DIMENSIONS | BOOLEAN | false | — |
| RESIZE METHOD | COMBO | lanczos | 4 options: lanczos, bicubic, bilinear, nearest |
| CROP | BOOLEAN | true | — |
| CROP POSITION | COMBO | center | 5 options: center, top, bottom, left, right |
| MODEL SDXL (opt)opt | CMK_MODEL_PIPE | — |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| MODEL | CMK_MODEL_PIPE | — |
| PROCESS | CMK_RESULT_PROCESS | — |
| IMAGE | IMAGE | — |
| LOG | CMK_LOG_PIPE | — |
| diagnostic | CMK_DIAGNOSTIC | — |
| MASK | MASK | — |
| image_file | STRING | — |