ipadapter/utilsgenerated

Prep Image For ClipVision(PrepImageForClipVision)

Prep Image For ClipVision node from ComfyUI-IPAdapter-plus.

Prep Image For Clip Vision

image
IMAGE
interpolation
COMBO
crop_position
COMBO
sharpening
0.00
IPAdapter plus

Description

Prep Image For ClipVision prepares an image before it is passed to a CLIP Vision model, as used in IPAdapter workflows. It resizes the image to the square resolution CLIP Vision expects (224 x 224) using a selectable interpolation filter, decides how to handle any mismatch between the source aspect ratio and that square target (crop to an edge, crop to the center, or pad), and can optionally apply sharpening. The result is a single prepared IMAGE ready to be connected to the CLIP Vision encoding stage.

Inputs

image

The source IMAGE to prepare. Any resolution or aspect ratio is accepted; the node performs the resizing and framing needed to reach the CLIP Vision input size.

interpolation

The resampling filter used when scaling the image. Options are:

  • LANCZOS: sharpest of the available filters, good for downscaling with detail retention.
  • BICUBIC: smooth, high quality general purpose filter.
  • HAMMING: slightly softer resampling filter.
  • BILINEAR: fast and smooth, softer than bicubic.
  • BOX: simple area averaging, useful for heavy downscaling.
  • NEAREST: no interpolation, preserves hard pixel edges.

The choice affects how much fine detail and aliasing survive the resize before the image reaches CLIP Vision.

crop_position

Controls how the image is fitted into the square target when the aspect ratio does not match. Options are top, bottom, left, right, center, and pad.

  • top, bottom, left, right: crop the image toward that edge, discarding the opposite side.
  • center: crop evenly from both sides, keeping the middle of the frame.
  • pad: instead of cropping, fit the whole image inside the square and fill the remaining area with padding. Use this when no part of the image should be cut off.

sharpening

A FLOAT value from 0 to 1, default 0, step 0.05. It controls the amount of sharpening applied after resizing. At 0 no sharpening is applied. Higher values increase edge contrast, which can help recover crispness lost during downscaling, but too high a value produces visible halos and noise.

Outputs

IMAGE output

The prepared image, resized to the CLIP Vision input resolution with the chosen interpolation, cropping or padding applied, and sharpening baked in. Connect it to a CLIP Vision encode node, or to any other node expecting a prepared image.

Usage Notes

  • The node does not encode anything itself; it only produces the image tensor. Pair it with a CLIP Vision loader/encoder in an IPAdapter pipeline.
  • center is a safe default for most photographic inputs where the subject sits in the middle of the frame.
  • Use pad when cropping would remove important content, for example a full body shot or a wide composition.
  • Sharpening is applied after resizing, so a small amount (around 0.1 to 0.3) is often enough to counteract the softness introduced by downscaling.
  • Because CLIP Vision expects a square input, the crop_position setting has the largest visible effect on non-square source images.

Comments

Sign in with GitHub to join the discussion.

Loading comments…