Enviral Image Resize Kit
One resize node that does pass-through, pad, crop, and stretch — without the math
- image
- mask
- image
- width
- height
- mask
Every ComfyUI user eventually has a "this image is the wrong resolution" moment, and the fix depends on why it's wrong. Sometimes you need a pure pass-through (leave it alone). Sometimes you need to stretch to exact dimensions. Sometimes you need to pad to a target aspect ratio without cropping content. Sometimes you need to fill that ratio and crop the overflow. Most workflows build this out of three different native nodes and a pile of aspect-ratio arithmetic.
Enviral Image Resize Kit folds all four into one node, with a mode input that doubles as a string alias: pass-through, explicit resize, inside fit, or outside fit. Same geometry applied to an optional mask, and it hands back the actual resulting dimensions - no math on your part.
How it works
Four modes, clearly named:
- pass-through - ignores width/height entirely, returns the input as-is. Useful as a "don't touch this branch" placeholder.
- explicit resize - stretches to exactly
width×height, aspect ratio be damned. What it says on the tin. - inside fit - preserves the whole image and pads with
letterbox_colorto hit the requested aspect ratio, then outputs exactlywidth×height. Think "contain." - outside fit - fills the requested aspect ratio and center-crops the overflow. Think "cover."
The mode input is a dropdown but also accepts linked strings with friendly aliases - crop, pad, resize, cover, contain, letterbox, stretch all map to the matching mode. That's a nice touch for string-driven graphs.
letterbox_color accepts simple names (black, white, gray), R,G,B integers, 0.0-1.0 float triples, or #RRGGBB hex.
The inputs that matter
image- the batch to resize.mode- the behavior. This is the decision.width/height- requested output, 1–16384; ignored by pass-through.letterbox_color- only used by inside fit.mask(optional) - transformed with the same geometry as the image, so masks stay aligned with pixels.
Outputs: image, plus width and height (the actual resulting size, as INT) and mask.
Install
Part of the Enviral Design Node Pack. ComfyUI Manager: search "Enviral Design Node Pack". Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/EnviralDesign/comfyUI-enviral-design-node-pack
then restart. No extra dependencies - it runs on Pillow/NumPy/PyTorch that ComfyUI already has.
Where it earns its keep
This is a workflow-glue node: pre-roll frames to a target aspect ratio before a sampler, or normalize a mixed-resolution batch before a video model that demands divisibility. The width/height outputs are the quiet win - feed them into a resolution-aware node downstream and you've eliminated the "I resized it and now don't know what size it actually is" class of bugs. The common trap is expecting explicit resize to preserve aspect ratio; it won't, and that's the point of the other two modes. Pick the mode for the job, not the one that sounds closest.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mode | COMBO | pass-through | Resize mode. Also accepts linked strings like crop, pad, resize, or pass-through. |
| width | INT | 10241–16384 | — |
| height | INT | 10241–16384 | — |
| letterbox_color | STRING | 0,0,0 | Color used only for inside fit. Accepts R,G,B, 0-1 floats, hex, or simple names. |
| maskopt | MASK | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| width | INT | — |
| height | INT | — |
| mask | MASK | — |