Nodes/ComfyUI_IPAdapter_plus_V2/Prep Image For ClipVision V2
ComfyUI Node

Prep Image For ClipVision V2

Prep your reference the way CLIP actually wants it

By chflame163·Created 2 years ago·Updated 2 years ago· 55
Prep Image For ClipVision V2
  • image
  • IMAGE
interpolation
crop_position
sharpening0.00

The CLIP vision encoder that reads your IP-Adapter reference image is trained on 224×224 thumbnails. Feed it a huge 1024×1536 photo and it's going to squish or crop it in a way you don't control. PrepImageForClipVisionV2 puts that decision in your hands: it resizes your reference to the 224×224 input size with the interpolation you pick, crops it the way you want, and optionally sharpens it before the encoder ever sees it.

This is the node to reach for when your reference is a weird aspect ratio, a face is getting lost in the crop, or you want to squeeze more detail into what CLIP actually ingests. By default IP-Adapter's internal preprocessing does a center crop and a resize and gets on with life; this node exists because "get on with life" isn't always the right call.

The inputs that matter:

  • interpolation - LANCZOS is the default and generally the right one for downscaling; NEAREST and BOX are there for pixel-art or when you want a harder-edged look, but expect them to fight you.
  • crop_position - the one that changes what the model "sees." top, bottom, left, right, and center crop to a square from that edge; pad is the interesting one: it pads the image to a square with black bars instead of cropping anything away. For a tall portrait you want top so the face stays in frame; for a wide landscape, left/right/center decide which slice becomes the reference.
  • sharpening - 0 to 1, default 0. A little contrast-adaptive sharpening before encoding can recover crispness that a downscale smears away, useful when your reference is soft.

The single output is an IMAGE ready to drop into the image input of any apply node. Note that it returns one image per input image, so a batch stays a batch.

Why you'd bother

CLIP reads 224×224 regardless. The question is what ends up in that tiny window. A reference image with a small subject in a big frame will, after a center crop, feed the encoder mostly background - and IP-Adapter will happily condition on that background. Prepping the image so the subject fills the crop is frequently the difference between "close to the reference" and "the reference barely shows up." For faces specifically, cropping tight with top beats the default every time.

Install

Part of chflame163/ComfyUI_IPAdapter_plus_V2, the V2-suffixed fork of cubiq's IP-Adapter pack. Via Manager (search ComfyUI_IPAdapter_plus_V2) or:

cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_IPAdapter_plus_V2

Restart. No pip requirements - ComfyUI's own torchvision/PIL handle everything here.

Gotchas

Sharpening is a dial, not a button: past ~0.3 you start inventing halos and the encoder picks up artifacts you didn't intend. And pad adds black bars, which means the padded regions become part of the conditioning - if you pad a light image, the model may try to reintroduce dark edges. One more: this node only resizes and crops; it doesn't normalize to the exact channel format some CLIP variants expect, which is why it's called "Prep" and not "Perfect." For most workflows it's a straight upgrade over letting the internals guess.

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