Nodes/JPS Custom Nodes for ComfyUI/Prepare Image Plus (JPS)
ComfyUI Node

Prepare Image Plus (JPS)

Per-side crop, padding, stretch, and flip

By JPS-GER·Created 3 years ago·Updated 2 years ago· 100
Prepare Image Plus (JPS)
  • image
  • IMAGE
target_w1024
target_h1024
offset_w0
offset_h0
crop_left0
crop_right0
crop_top0
crop_bottom0
padding_left0
padding_right0
padding_top0
padding_bottom0
interpolation
sharpening0.00
resize_type
flip

This is the "I need more control than a centered zoom" version of Prepare Image (JPS). Where the plain node gives you one symmetric crop-percent-plus-offset control, Prepare Image Plus gives you four independent per-side crops, four independent paddings, a choice between cropping and stretching, and a flip - for the cases where a reference image needs asymmetric handling (strip a watermark strip off the bottom without touching the top, or pad out to an exact aspect ratio instead of losing content to a crop).

How it works

Going by the parameter set, the pipeline runs crop first, then padding, then the final resize to target. crop_left, crop_right, crop_top, crop_bottom (each 0–90%) trim each edge independently - unlike the plain Prepare Image node, there's no single symmetric zoom here, you decide each side on its own. padding_left/right/top/bottom (0–500px) then add canvas back around whatever's left, which is the tool for when you'd rather letterbox than lose content - useful if you need an exact target aspect ratio but cropping would cut off something you want to keep.

resize_type picks how the result reaches target_w/target_h: Crop keeps proportions and trims excess, Stretch distorts the image to fit exactly - a real option if you'd rather warp an image than lose any of its content. flip mirrors the result on the X or Y axis, handy for quick augmentation or matching a composition's mirrored counterpart. offset_w/offset_h here are percentage-based (-99 to 99), not pixel-based like the plain Prepare Image node's - worth flagging specifically, because the two nodes look similar but don't share units, and copying an offset value between them won't do what you expect.

The inputs and outputs that matter

  • image (IMAGE, required); target_w, target_h (INT, default 1024, steps of 8).
  • crop_left/right/top/bottom (0–90%) - independent per-side cropping.
  • padding_left/right/top/bottom (0–500px) - independent per-side padding.
  • offset_w/offset_h (-99 to 99, percentage-based).
  • interpolation (lanczos/nearest/bilinear/bicubic/area/nearest-exact) and sharpening (0–1) - same as the plain node.
  • resize_type (Crop / Stretch) and flip (No / X-Axis / Y-Axis).
  • Output: IMAGE.

How to install 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. Pure image processing, no models or unusual dependencies.

Common issues & troubleshooting

Crop and padding fighting each other. If you crop aggressively on one axis and then pad it back out, you can end up with a result that looks like you did nothing - because in a sense you did, you removed content and then added blank canvas back. Test crop and padding values one at a time on a throwaway image rather than dialing in both blind.

offset_w/offset_h "doing nothing" compared to Prepare Image. If you're used to the plain node's pixel-range offsets and plug in a similar number here, you'll get a much smaller shift - this node's offsets are percentage-based (-99 to 99), so a value like 50 here means something very different from 50 on Prepare Image.

Stretch distorting things you didn't expect. resize_type: Stretch will happily warp a face or a logo to fit your target aspect ratio. If proportions matter (most reference images for IP-Adapter or ControlNet), stick with Crop and use padding instead if you need to hit an exact aspect ratio without losing content.

CategoryJPS Nodes/Image

Inputs (17)

NameTypeDefaultDescription
imageIMAGE
target_wINT1024
target_hINT1024
offset_wINT0-99–99
offset_hINT0-99–99
crop_leftINT00–90
crop_rightINT00–90
crop_topINT00–90
crop_bottomINT00–90
padding_leftINT00–500
padding_rightINT00–500
padding_topINT00–500
padding_bottomINT00–500
interpolationCOMBO6 options: lanczos, nearest, bilinear, bicubic, area, nearest-exact
sharpeningFLOAT0.000–1
resize_typeCOMBO2 options: Crop, Stretch
flipCOMBO3 options: No, X-Axis, Y-Axis

Outputs (1)

NameTypeDescription
IMAGEIMAGE