π Kraken Image Resize
Resize images the way the pipeline needs, without a ladder of scale nodes
- image_input
- image
- width
- height
- info
Resizing sounds like it shouldn't need a dedicated node, and then you try to feed a 2:3 reference photo into an SDXL img2img workflow and discover the stock tools only do half the job. π Kraken Image Resize is the Kraken Tools answer: one node that covers "shrink to the longest side," "pad to a target with a background color," "stretch to fill," and everything between, with a choice of interpolation and a guarantee that your output dimensions come out as numbers you can wire onward.
It sits in the middle of the pack's upscale chain - resize the source to working size, let Kraken Image Processor clean it, then upscale. And because it's built for pipeline use, it hands you the final width, height, and a text info summary as outputs, so the graph never has to guess what size something ended up at.
How it works
The inputs break into two groups: where the image comes from and what you want done to it.
Source: source_mode = upload (use the file picker) or upstream (accept image_input from a node). In any real workflow you want upstream; the upload option with image_upload is for testing the node standalone.
The sizing logic, which is where this node earns its keep:
- resize_mode -
longest_side(fit the longest edge tolongest_side, keep aspect),width,height,fit(contain within both bounds),fill(cover a target, cropping the overflow), orstretch(distort to exact dimensions). - longest_side - the anchor number, default 1024, which is the sweet spot for SDXL-scale generation.
- width_override / height_override - used by
fitandfillas the second bound, and bywidth/heightmodes as the target. - maintain_aspect - on by default; turn it off and
stretch/fillstop trying to preserve ratio. - upscale_smaller - off by default, which means the node refuses to upscale a small source past its natural size. Flip it on only if you genuinely want a 512px image blown up to 2048 (hint: you don't - let an AI upscaler do that instead).
- interpolation -
lanczos(default; best quality for downscale and mild upscale),bicubic,bilinear,nearest(pixel-art, don't use for photos),area(good for aggressive downscales). - background_color - hex like
#000000, used byfillwhen padding to a target. - output_format -
same(keep the source format), or force PNG/JPEG/WEBP.
Outputs
- image β the resized batch, straight into your img2img, ControlNet preprocessor, or upscaler.
- width / height (INT) β the final dimensions, for resolution-aware nodes.
- info (STRING) β a processing summary ("resized 3024x4032 β 1024x1365, lanczos") you can drop on a text display.
Install
Standard Kraken Tools install. ComfyUI Manager β search "Kraken Tools" β Install β restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/krakenunbound/comfyui-kraken-tools
cd comfyui-kraken-tools
pip install -r requirements.txt
No model files. The resizing is done with Pillow (via the pack's deps), so nothing heavy to download.
Where people get burned
stretchis lying to you if you care about ratio. It's the mode you want for exact canvas fill, and the mode that quietly ruins a face otherwise. If a character's head looks wrong after an img2img pass, check whether astretchresize flattened the source first.upscale_smalleroff means no output change. The node isn't broken; it's refusing to upscale. This is a common "it did nothing" moment - read theinfooutput before assuming a bug.longest_sidedoesn't snap. Unlike the pack's latent node, this one doesn't force dimensions to a multiple. If you're feeding its output into something that wants 8/16-divisible sizes (latent encode, video VAEs), the sizes it hands back may be off by a pixel or two. Pair it with adivisible_bysnap if your downstream cares.
The stock ImageScale does one mode and no bookkeeping. If you've ever found yourself stacking three scale nodes and a paste node just to get a padded 1024x1024, this is the node that replaces all four.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| source_mode | COMBO | upload | 2 options: upload, upstream |
| image_upload | COMBO | 1 options: example.png | |
| longest_side | INT | 102464β8192 | β |
| interpolation | COMBO | lanczos | 5 options: lanczos, bicubic, bilinear, nearest, area |
| maintain_aspect | BOOLEAN | true | β |
| resize_mode | COMBO | longest_side | 6 options: longest_side, width, height, fit, fill, stretch |
| upscale_smaller | BOOLEAN | false | β |
| output_format | COMBO | same | 4 options: same, PNG, JPEG, WEBP |
| image_inputopt | IMAGE | β | |
| width_overrideopt | INT | 51264β8192 | β |
| height_overrideopt | INT | 51264β8192 | β |
| background_coloropt | STRING | #000000 | β |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | β |
| width | INT | β |
| height | INT | β |
| info | STRING | β |