Prepare Image (JPS)
Crop, resize, and sharpen a reference image in one node
- image
- IMAGE
Any time you feed an image into something downstream that's picky about its dimensions - a ControlNet preprocessor, a CLIP vision encoder for IP-Adapter, an img2img source - you usually need to crop it, resize it to the right size, and maybe sharpen it back up after the resize softened it. Prepare Image (JPS) does all three in one node instead of chaining a Crop, a Resize, and a Sharpen node separately.
How it works
crop_w_percent and crop_h_percent aren't pixel values - they're "how much of each axis to keep," centered by default. 100% means no crop at all (you're only resizing); dial it down and you're effectively zooming in, keeping a smaller centered region of the source. offset_w and offset_h then let you slide that crop window off-center instead of it always being dead-middle, which matters when the thing you actually care about in the reference isn't in the center of the frame.
Once the crop is decided, the node resizes the result to target_w × target_h using whichever interpolation algorithm you picked (lanczos for general quality, nearest for pixel art, bicubic/bilinear/area as alternatives), and then applies sharpening as a final pass. That last step exists because downscaling - especially with a smooth algorithm like lanczos or area - genuinely blurs fine detail, and if what's consuming this image downstream is a CLIP vision encoder or a ControlNet preprocessor looking for crisp edges, a touch of sharpening back in can matter more than it sounds like it should.
The inputs and outputs that matter
image(IMAGE, required) - your source.target_w,target_h(INT, default 1024, steps of 8) - final output size. The step-of-8 constraint matches the universal diffusion-model rule that dimensions need to be multiples of 8.crop_w_percent,crop_h_percent(10–100%, default 100) - how much of each axis to keep before resizing.offset_w,offset_h(INT, ±4096) - shifts the crop window off-center.interpolation(enum: lanczos, nearest, bilinear, bicubic, area, nearest-exact) - the resize algorithm.sharpening(0–1, default 0) - post-resize sharpening strength.- Output:
IMAGE- the prepared result.
How to install it
Via ComfyUI Manager, searching "JPS Custom Nodes for ComfyUI," or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/JPS-GER/ComfyUI_JPS-Nodes.git
Restart ComfyUI. This is a pure image-processing node - no model downloads, no unusual Python dependencies beyond what ComfyUI already ships with for image handling.
Common issues & troubleshooting
Confusing crop percent with crop pixels. People new to this node sometimes expect crop_w_percent: 50 to crop exactly 50 pixels off. It doesn't - it's a percentage of the source image's own width, kept centered (then shifted by offset). Think "zoom level," not "pixel count."
Offset pushing past the edge of the image. Push offset_w/offset_h far enough and you're asking the node to crop a region that partly falls outside the source - the practical result is usually a clamp toward the edge rather than an error. If output looks wrong after nudging the offset, dial it back toward 0 first.
Output still looks soft after sharpening. sharpening maxes out at 1 - it's a bounded unsharp-mask-style pass, not an unlimited dial. If a heavily downscaled image still looks soft at sharpening: 1, the fix is usually to reconsider interpolation (lanczos tends to preserve more perceived sharpness than area) rather than expecting more from this slider.
If you need independent control per side (crop more off the top than the bottom, say) or padding instead of cropping, that's what Prepare Image Plus (JPS) is for.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| target_w | INT | 1024 | — |
| target_h | INT | 1024 | — |
| crop_w_percent | INT | 10010–100 | — |
| crop_h_percent | INT | 10010–100 | — |
| offset_w | INT | 0-4096–4096 | — |
| offset_h | INT | 0-4096–4096 | — |
| interpolation | COMBO | 6 options: lanczos, nearest, bilinear, bicubic, area, nearest-exact | |
| sharpening | FLOAT | 0.000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |