Nodes/ComfyUI_IPAdapter_plus/Prep Image For ClipVision
ComfyUI Node Runs on cloud

Prep Image For ClipVision

Control how your reference gets cropped

By cubiq·Created 3 years ago·Updated about a year ago· 6,085
Prep Image For ClipVision
  • image
  • IMAGE
interpolation
crop_position
sharpening0.00

Small node, real usefulness. The CLIP vision encoder that IP-Adapter uses wants a square, low-resolution image (224px), and if you hand it a tall portrait or a wide landscape, something has to crop and resize it. By default that happens automatically and you don't get a say. Prep Image For ClipVision gives you the say - you decide how the reference is cropped and resized before it ever reaches the adapter.

That matters more than it sounds. IP-Adapter can only condition on what the encoder actually sees. If your reference is a full-body shot and the auto-crop grabs the center, you might be feeding the model a torso when you wanted the face. Prep the image deliberately and you control what the reference is.

Inputs and outputs

One image in, one image out - the prepped version, ready to feed into any apply node's image input. The controls:

  • crop_position - the setting. Options are top, bottom, left, right, center, and pad. For a portrait where the face is up top, top keeps the face and drops the body. center is the usual default behavior. pad is the important escape hatch: instead of cropping anything away, it pads the image to square, so nothing is lost - use this when the whole frame matters and you can't afford to cut any of it.
  • interpolation - the resampling algorithm for the downscale: LANCZOS, BICUBIC, HAMMING, BILINEAR, BOX, NEAREST. LANCZOS is the high-quality default and rarely worth changing.
  • sharpening - 0 to 1, default 0. A little sharpening can recover crispness lost when the image is crushed down to 224px. A small amount (say 0.1–0.3) sometimes helps detail transfer; too much introduces artifacts.

When to bother

You don't always need this - the apply nodes crop fine on their own for centered subjects. Reach for it when:

  • Your subject isn't centered (crop to top for a face at the top of the frame, etc.).
  • You're feeding a wide or tall reference and the default center-crop is throwing away the part you care about.
  • You want the entire reference considered - use pad so nothing gets cut.
  • Detail transfer looks soft and a touch of sharpening might claw some back.

It's a framing tool, plain and simple. Think of it as aiming the encoder at the right part of your reference. On faces especially, controlling the crop is the difference between "the model saw the face" and "the model saw a shoulder."

Installing the pack

ComfyUI Manager: search "IPAdapter plus" in the Custom Nodes Manager, install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/cubiq/ComfyUI_IPAdapter_plus, then restart ComfyUI. This particular node needs no model of its own - it's pure image preprocessing - but it only earns its keep in front of the rest of the IP-Adapter pack, which needs the IP-Adapter models in ComfyUI/models/ipadapter and CLIP vision encoders in ComfyUI/models/clip_vision. Update ComfyUI if anything fails to load.

Categoryipadapter/utils

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
interpolationCOMBO6 options: LANCZOS, BICUBIC, HAMMING, BILINEAR, BOX, NEAREST
crop_positionCOMBO6 options: top, bottom, left, right, center, pad
sharpeningFLOAT0.000–1

Outputs (1)

NameTypeDescription
IMAGEIMAGE