Nodes/ComfyUI-Apt_Preset/Image_solo_crop2
ComfyUI Node

Image_solo_crop2

Crop a subject out by its mask, ready to stitch back later

By cardenluo·Created 2 years ago·Updated 18 days ago· 309
Image_solo_crop2
  • image
  • mask
  • mask_stack
  • crop_image
  • crop_mask
  • stitch
crop_mode无缩放_裁切
long_side512
upscale_methodbilinear
expand_width0
expand_height0
divisible_by2
crop_img_bjimage
auto_expand_squarefalse

This is the current, non-deprecated version of Image_solo_crop - same idea, trimmed down. You feed it an image and a mask, it crops out the masked region (optionally scaled and padded), and hands back a stitch receipt so you can paste the processed crop back into the original frame later. It's the go-to when you want to run a sampler or an effect on just a subject - a face, a product, a person - at a smaller working resolution instead of processing the whole frame, then reassemble at full size without redoing the crop math by hand.

Why crop before you process

Running a full-resolution image through a sampler when you only care about one region is wasteful - more VRAM, more time, and often worse results because your subject is a small fraction of the frame the model is attending to. The standard fix, familiar from inpainting workflows built around crop-and-stitch patterns, is: crop tight around what matters, process at a sane working size, then paste the result back onto the untouched original. Image_solo_crop2 is this pack's implementation of the crop half of that pattern; Image_solo_stitch (or Image_Solo_data if you just need the numbers) is the paste-back half.

The inputs and outputs that matter

  • crop_mode - three options, and the labels ship in Chinese in the dropdown (this is a Chinese-authored pack; don't be alarmed): 不裁切 (no crop - outputs the original image, optionally with edge feathering blended in), 无缩放_裁切 (crop without scaling - the default, a tight crop at native resolution), 缩放后_裁切 (scale the long side, then crop).
  • long_side (INT, default 512) - target size when a scale mode is active.
  • upscale_method - interpolation for any scaling (nearest-exact, bilinear default, area, bicubic, lanczos).
  • expand_width / expand_height (INT, 0–2048) - pad the crop box outward before cutting, so you get margin around the subject instead of a boundary that hugs the mask exactly.
  • divisible_by (INT, default 2) - rounds the crop to a multiple of this.
  • Optional auto_expand_square (BOOLEAN) - force the crop into a square.
  • Optional mask_stack (this pack's MASK_STACK2 type) and crop_img_bj - a fill color for anything outside the crop region if you're not using the literal background.

Three outputs: crop_image, crop_mask, and stitch (a STITCH2 bundle). That stitch is a pack-specific type - it connects to Image_Solo_data or Image_solo_stitch, not to Image_Resize_sum's restore chain, which uses a different bundle type (STITCH3).

How to install it

ComfyUI Manager: search ComfyUI-Apt_Preset, install, restart. Manual:

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

install.bat is the Windows convenience script; on Linux (comfy.icu's executor included) run pip install -r requirements.txt. No model downloads needed for this node.

Common issues

The Chinese-language crop_mode labels trip people up the most, especially if your ComfyUI locale is set to English elsewhere - they're just the literal enum strings the author shipped, and the mapping above is accurate to what they mean, but there's no in-UI English translation for that particular dropdown. Read them once, and you'll recognize them from then on.

Second most common issue: forgetting the expand margin. With expand_width/expand_height at 0, the crop hugs the mask exactly, which is usually too tight once you stitch the processed result back - a hard edge with no room to feather. Give it 20–50px of margin unless you specifically need a pixel-tight crop.

And the pack-wide caveat that applies everywhere in ComfyUI-Apt_Preset: a fresh install pulls a large requirements.txt (onnxruntime, gguf, transparent-background, scenedetect, and more, for the other 100+ nodes in the suite), and there's a real, reported case of that failing to import cleanly. If the whole pack throws IMPORT FAILED, check the ComfyUI console for the specific missing package rather than assuming this node broke it.

CategoryApt_Preset/image

Inputs (11)

NameTypeDefaultDescription
imageIMAGE
crop_modeCOMBO无缩放_裁切3 options: 不裁切, 无缩放_裁切, 缩放后_裁切
long_sideINT51216–9999
upscale_methodCOMBObilinear5 options: nearest-exact, bilinear, area, bicubic, lanczos
expand_widthINT00–2048
expand_heightINT00–2048
divisible_byINT20–128
maskoptMASK
mask_stackoptMASK_STACK2
crop_img_bjoptCOMBOimage10 options: image, white, black, red, green, blue, +4
auto_expand_squareoptBOOLEANfalse

Outputs (3)

NameTypeDescription
crop_imageIMAGE
crop_maskMASK
stitchSTITCH2