Image Resize FluxKontext
Put your reference image on Flux Kontext's native grid
- image
- mask
- image
- mask
Flux Kontext - Black Forest Labs' 12B in-context editor - doesn't work the way adapter-based editors do. It concatenates your reference image into the model's context alongside the prompt rather than embedding it through an adapter, which is exactly why it holds identity so well across edits. And that's also why input resolution matters more: the reference has to fit the model's resolution grid cleanly. Image Resize FluxKontext is the node that makes that alignment a one-step drop: it resizes your image - and any mask - to one of 17 FluxKontext presets, or auto-picks the closest one.
If you run Kontext character-consistency or turnaround-sheet workflows - or anything that feeds a reference image into Kontext - this is the "get the geometry right" node.
How it works
The preset ladder is Kontext's full resolution set: 1024×1024 at the center, portrait steps down to 672×1568 (3:7), landscape up to 1568×672 (7:3), with intermediates in between. auto compares your input's aspect ratio to all 17 and picks the nearest.
Then fit gets you to the target:
- crop - center-crop to the target aspect, then resize. Clean edges, some content lost.
- pad - keep aspect, center-pad;
pad_colorhandles the bars with strategies likeedge,average,extend(replicate), ormirror(reflect) - so padding blends instead of framing your image in white. - stretch - direct resize, distorts.
The mask output is synchronized the whole way: crop mode's mask marks the crop window, pad mode's marks content-vs-padding (white = real content, black = bars), stretch is full white. Masks are resampled with nearest-neighbor so their hard edges stay crisp.
Install
Part of ComfyUI-1hewNodes:
cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes
Restart ComfyUI. No model downloads, no extra deps - resize math only. Current ComfyUI expected (v3 node API).
Where it fits
In front of a Kontext conditioning stack. You load a reference, this node snaps it to a preset, and the Kontext encoder gets clean input. One worthwhile context: Kontext ships under the FLUX.1 [dev] Non-Commercial License, and BFL polices NSFW derivatives - if you've moved your editing workloads to Qwen-Image-Edit for licensing reasons, the pack's parallel Image Resize QwenImage node is the same idea with QwenImage's ladder.
Common issues
automatches aspect, not pixel size - a huge panorama and a small one with the same ratio land on the same preset. If you need long-side control, that'sImage Resize Universal's job.- Only a mask connected - fine; it generates a solid-color image from
pad_colorand resizes the mask alongside. Intended behavior. - "Why is my image 672 wide?" - you're in a portrait preset. The ladder is heavily weighted to portrait/landscape extremes for turnaround sheets; for a square workflow force
1024×1024.
It's a preset adapter, and it doesn't pretend to be more. Plug it in front of Kontext, and you stop thinking about resolution buckets entirely.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| preset_size | COMBO | auto | 18 options: auto, 672×1568 [1:2.33] (3:7), 688×1504 [1:2.19], 720×1456 [1:2.00] (1:2), 752×1392 [1:1.85], 800×1328 [1:1.66], +12 |
| fit | COMBO | crop | 3 options: crop, pad, stretch |
| pad_color | STRING | 1.0 | — |
| imageopt | IMAGE | — | |
| maskopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |