Crop Image Square (JPS)
Square up a reference image for CLIP Vision
- image
- IMAGE
Half the trouble with IP-Adapter and Revision-style workflows is that CLIP Vision encoders want a square input, and your reference photos never are. Crop this by hand and you either lose the part of the image you actually care about or end up with a stretched, distorted embedding feeding your generation. This node exists specifically for that step: crop an image to a square aspect ratio, pick which part of the frame survives, and optionally resize the result to whatever target size your downstream encoder wants - per the pack's own README, this is built with CLIP Vision inputs (IP-Adapter, Revision) in mind.
How it works
It's a straightforward crop-and-resize, but with more control than a generic center-crop node gives you. You choose a crop anchor (center, top, bottom, left, right), nudge it with an offset, apply a zoom if you want to crop in tighter than the plain anchor position, then optionally resize the square result to an exact target and sharpen it a touch to counter resize softening.
The inputs that matter
crop_position- center, top, bottom, left, or right. Which part of the (non-square) source image the square crop is anchored to. If your subject is off-center - a face near the top of a portrait, say - pick the matching side instead of taking a dead-center crop that cuts them off.offset_x/offset_y(-4096 to 4096) - fine-tune the anchor further, in pixels, once the basic position is close but not quite right.zoom(1–5, default 1) - crop in tighter than the base square. At 1 you get the largest square the source allows; push it higher to frame in closer, useful when you want just a face or a smaller detail rather than the whole subject.target_rez(default 0, step 8) - resize the final square crop to this pixel size. Zero means keep the crop's native size; a nonzero value (steps of 8, since diffusion-adjacent pipelines want dimensions divisible by 8) resizes down or up to match - this is the knob you'd use to hit a CLIP Vision encoder's expected input size.interpolation- lanczos, nearest, bilinear, bicubic, area, or nearest-exact. Lanczos is the sharpest general-purpose choice for downscaling; bicubic is a reasonable default if lanczos looks too crisp/ringing on a particular image.sharpening(0–1, default 0) - a mild sharpen pass after resizing, useful iftarget_rezis shrinking the image enough to soften detail you want to keep.
Output is a single IMAGE - the square-cropped (and optionally resized) result, ready to feed a CLIP Vision loader or an IP-Adapter/Revision image input directly.
Installing it
ComfyUI Manager: search JPS Custom Nodes for ComfyUI. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/JPS-GER/ComfyUI_JPS-Nodes.git
Restart ComfyUI. No models, no extra dependencies - it's a pure image-processing node. Delete any older copy of the pack before reinstalling, as the README recommends.
Where people get tripped up
The most common miss is picking a crop_position that doesn't actually cover your subject - if the crop looks like it's cutting off the wrong part of the frame, the fix is almost always the anchor and offset, not the zoom. Second: a target_rez of 0 is easy to forget about entirely, which is fine if you don't need an exact size, but if you're feeding a CLIP Vision model that expects a specific resolution and you leave this at 0, you're relying on that downstream node to resize correctly on its own rather than controlling it here.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| crop_position | COMBO | 5 options: center, top, bottom, left, right | |
| offset_x | INT | 0-4096–4096 | — |
| offset_y | INT | 0-4096–4096 | — |
| zoom | FLOAT | 1.01–5 | — |
| interpolation | COMBO | 6 options: lanczos, nearest, bilinear, bicubic, area, nearest-exact | |
| target_rez | INT | 0 | — |
| sharpening | FLOAT | 0.000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |