LayerUtility: Flux Kontext Image Scale
FluxKontextImageScale — snap an image to Flux Kontext's happy resolutions
- image
- IMAGE
Flux Kontext - Black Forest Labs' instruction-based image editor - is fussy about input resolution. Feed it an image at an odd size and edits come back soft, cropped, or subtly warped. FluxKontextImageScale is a one-input fix: hand it your image and it resizes to a resolution Kontext actually likes, adjusting the scale to preserve the whole frame for whatever aspect ratio you started with. The node's own description puts it plainly - it resizes to something "more optimal for flux kontext," and for off-ratio images "the scale will be adjusted appropriately to maintain all information."
How it works
Kontext was trained around a set of preferred resolution buckets. This node takes your image's dimensions, picks the nearest good bucket for that aspect ratio, and resamples to it - so you're not guessing at a size or manually matching the reference and edit resolutions. It's a small, single-purpose convenience that removes one of the more annoying footguns in a Kontext workflow.
Drop it right before the node that encodes your image into the Kontext pipeline. That way the reference image and the latent it produces are both at a resolution the model expects, which is what keeps edits crisp and correctly framed.
The inputs and output that matter
There are only two inputs, and one of them you'll rarely touch:
image(IMAGE) - the image you're about to edit with Kontext.method- the resampling filter:lanczos,bicubic,hamming,bilinear,box, ornearest.lanczosis the sharp default and the right pick for almost everything;nearestonly if you're deliberately preserving hard pixel edges.
Output is a single IMAGE at the Kontext-friendly size. Wire it into your VAE encode / Kontext reference input.
How to install it
In ComfyUI Manager, search ComfyUI Layer Style, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle
then install requirements.txt into ComfyUI's Python and restart. It's a large pack, so first startup takes a moment. The node sits under 😺dzNodes → LayerUtility.
Common issues
There's not much to break here - it's about as simple as a node gets. The main thing to know is what it doesn't do: it won't fix a Kontext workflow that's mis-wired elsewhere, and it's only relevant for Kontext. For general aspect-ratio resizing in other pipelines, use ImageScaleByAspectRatio V2 from the same pack, which gives you fit modes, rounding, and per-side targeting. Reach for this node specifically when Kontext is in the graph and your edits are coming out lower quality than the model is capable of - a wrong input resolution is a common, easily-missed cause.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| method | COMBO | 6 options: lanczos, bicubic, hamming, bilinear, box, nearest |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |