[SSN] Prep Crop
Center-crop or center-pad any batch to a fixed canvas size
- images
- IMAGE
[SSN] Prep Crop is the "make everything the same canvas size" node. Give it an image batch plus a target_width and target_height, and it returns every image resized to that exact canvas - if the image is smaller, it's centered on a transparent background with padding; if it's larger, it's center-cropped down to fit. In and out, every frame of the batch is identical dimensions.
That "identical dimensions" is the entire reason the node exists. ComfyUI's IMAGE tensors require consistent shape across a batch - you literally cannot put a 512-wide and a 640-wide frame in the same tensor - and video pipelines are unforgiving about mixed sizes. If your frames come from different crops, different models, or different aspect ratios, they have to be normalized before they can be concatenated, encoded, or fed through anything that expects a uniform batch. This node does that normalization, keeping content centered so the subject doesn't jump around.
Mechanically it's simple and honest: each frame is converted to NumPy, the paste offset is computed from the size difference ((target - current) // 2), and the frame is either blitted onto a zero-filled canvas or cropped with clamping for the overflow. Note the padding is transparent (alpha 0), not white or black - so if you pad a batch of opaque images and then flatten them, you choose the fill color at flatten time. And like its siblings in the prep family, it requires 4-channel RGBA input and throws "Images must be RGBA" otherwise. This is the pack's consistent contract: prep nodes speak RGBA.
Where it fits in the pipeline: it's the "before" stage - normalize everything to a target canvas before Draw Text, before Trim Scale, or before batch assembly. It's also the poor-man's aspect-ratio unifier if you're mixing portrait and landscape generations into one video.
Install
Part of smn_support_nodes by SummonTheCat. ComfyUI Manager → search smn_support_nodes → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/SummonTheCat/smn_support_nodes
Restart required. Dependencies (opencv-python, imageio-ffmpeg) auto-install; no models to download.
Troubleshooting
The two things that get people: (1) feeding RGB input, which errors because the node requires RGBA; (2) expecting white or black padding - it's transparent, so plan to follow up with SsnPrepFlattenAlpha to choose an opaque background. Also remember this node does not stretch - content keeps its aspect ratio, so padding or cropping is always on the sides/top that are too small or too big. If you need actual aspect-preserving scale-to-fit inside the canvas, SsnPrepTrimScale is the more featureful cousin.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| target_width | INT | — | |
| target_height | INT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |