PixelForge · Resize Image
Crop, pad, or stretch your way to a valid size
- image
- mask
- image
- width
- height
- mask
This is the practical half of the room3dev/ComfyUI-PixelForge pack. Where the plain PixelForge node just hands you a valid resolution, PixelForgeResizeImage actually does something with it - it takes an image, resizes it to a PixelForge-selected size, and gives you full control over what happens to the aspect ratio along the way. The author describes it as "PixelForge resolution selection combined with KJNodes Resize v2 features," which is a fair summary of the vibe.
The one honest take you need before anything else: this is a geometric resize, not an upscaler that adds detail. Under the hood it calls comfy.utils.common_upscale - literally the same function ComfyUI's core ImageScale node uses. It interpolates pixels; it cannot invent new detail. If your goal is "bigger and sharper with real texture," that's the job of a generative upscaler like SeedVR2 or SUPIR, and no amount of lanczos will substitute. Where this node genuinely shines is conforming an image to an exact canvas: feeding a ControlNet preprocessor that demands a specific size, preparing an image for image-to-video, fixing an input before a VAE encode, or letterboxing for compositing.
The settings that matter
The top half of the widget list is the shared PixelForge resolution logic - aspect_ratio, orientation, divisible_by, max_megapixels, and the filtered resolution dropdown, all behaving exactly as in the Resolution Selector node. Below that, the resize controls:
- keep_proportion - the one that defines the node. Five modes: stretch (squeeze to exact dims, distorts), resize (maintain input aspect, fit within the target), pad (resize then letterbox with your color), pad_edge (same, but pads by replicating edge pixels - a lot less ugly than black bars when you're feeding image-to-video), and crop (default: crop the image to the target ratio, then resize). For most use, crop or resize is the right call.
- crop_position (center/top/bottom/left/right) - where the crop or pad anchors. Only affects the crop and pad modes.
- upscale_method (nearest-exact, bilinear, area, bicubic, lanczos) - lanczos is the sensible default; it's the sharpest of the non-generative options. area is worth knowing for downscaling.
- pad_color - a comma-separated RGB string like
"0, 0, 0"for black. If the string won't parse, the node silently falls back to black, so a typo won't crash - it'll just give you black bars.
Inputs, outputs, and the mask gotcha
It takes an image, plus an optional mask that gets resized right alongside the image (the code routes lanczos through repeated channels to avoid banding on masks). Outputs are image, width, height - the actual final dimensions, handy for confirming the result - and mask. Here's the trap: the node always outputs a mask. If you didn't feed one in, you get an all-zeros mask out. Fine if you ignore it, annoying if you blindly wire it into something expecting a real selection. Only use the mask output if you passed a mask in.
One more code-level quirk: the file declares MAX_RESOLUTION = 8192 but never enforces it, so nothing stops you from requesting a huge size and blowing past what your model handles gracefully. That's a you-problem, not a node-problem - keep the size within your model's native range and upscale beyond that separately.
Installing and using it
Same as its sibling: ComfyUI Manager → search ComfyUI-PixelForge, or git clone https://github.com/room3dev/ComfyUI-PixelForge into ComfyUI/custom_nodes/ and restart. No dependencies beyond what ComfyUI already ships (just torch and comfy.utils), no models to fetch - one of the lightest packs you'll install. It shows up under the PixelForge category. There's zero community chatter about this pack yet, so treat it as fresh, unproven code - but for a resize helper that's about as low-risk as a custom node gets.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| aspect_ratio | COMBO | 1:1 | 5 options: 1:1, 3:2, 4:3, 16:9, 16:10 |
| orientation | COMBO | square | 3 options: landscape, portrait, square |
| divisible_by | COMBO | 16 | 3 options: 16, 32, 64 |
| max_megapixels | COMBO | 1 MP | 7 options: 1 MP, 2 MP, 4 MP, 6 MP, 8 MP, 12 MP, +1 |
| resolution | COMBO | 1024×1024 | 692 options: 16×16, 32×32, 32×48, 48×32, 48×48, 48×64, +686 |
| upscale_method | COMBO | lanczos | 5 options: nearest-exact, bilinear, area, bicubic, lanczos |
| keep_proportion | COMBO | crop | 5 options: stretch, resize, pad, pad_edge, crop |
| pad_color | STRING | 0, 0, 0 | RGB color for padding (e.g., '0, 0, 0' for black) |
| crop_position | COMBO | center | 5 options: center, top, bottom, left, right |
| maskopt | MASK | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| width | INT | — |
| height | INT | — |
| mask | MASK | — |