Resize Images To Megapixels
Resize to a megapixel target, not a resolution you have to memorize
- images
- images
Most resize nodes ask for a width and a height. This one asks for a number of megapixels, and it figures out the dimensions for you. Tell it 1.2, and it rescales whatever images you feed it - an entire batch at once - to roughly 1.2 megapixels, keeping the aspect ratio and snapping the result to a size your model's latent pipeline is happy with.
That's genuinely the right way to think about modern generation. A lot of current models don't care about exact trained ratios anymore; they care about being in a megapixel band. Feed a model built for 1MP–2MP a 4-megapixel latent and quality falls apart; undershoot and you leave resolution on the table. This node lets you say "keep me in the band" without remembering that 1.2MP works out to 1216×832, or doing the multiplication yourself.
How it works
It reads the aspect ratio from your batch, computes the width and height that give you the target pixel count, then rounds both to a multiple - 64 by default, since samplers and VAEs like working in multiples of 8/16/64 (SDXL and Flux both expect /64-friendly sizes). The whole batch is rescaled with bilinear interpolation in one shot, and the output comes back in the same dtype it went in.
Here's the honest part: bilinear resize adds no detail. This is a "more pixels" operation, not a "more detail" one. If you want the model to invent detail, that's a generative upscaler (ESRGAN for clean enlargements, tile-ControlNet or SeedVR2 when you want real recovery) - this node is the sizing step, not the enhancement step.
Inputs and outputs
images(IMAGE) - a single image or a whole batch; all frames get resized together.megapixels(FLOAT, 0.1–100, default 1.0) - the target. 1.0–1.5 covers most SDXL-era and current model sweet spots.multiple_of(INT, 1–512, default 64) - alignment. Leave at 64 unless you know you need something else.images(IMAGE) - the resized batch.
Typical wiring: output into a VAE encode → sampler chain for img2img, or as a pre-step before a detail pass. Because it's a batch operation, it slots neatly into video-frame prep too.
Installing it
Part of ComfyUI Fictiverse Nodes - no Python dependencies beyond ComfyUI's stack, no model downloads.
- ComfyUI Manager → search ComfyUI Fictiverse Nodes → Install, restart.
- Or:
cd ComfyUI/custom_nodes && git clone https://github.com/Fictiverse/ComfyUI_Fictiverse, restart.
Common issues
Rounding means the output is approximately your target: at 64-multiple snapping, a 1.0MP request might land at 0.98 or 1.02MP. That's expected, not a bug. The bigger disappointment is people expecting detail enhancement from the bilinear step and getting softness instead. Use it as a sizing gate and pair it with a real upscale for quality - this node is the "right-sized canvas," not the "detail generator."
And the usual pack caveat: shared workflows referencing Fictiverse nodes throw ModuleNotFoundError: No module named 'custom_nodes.ComfyUI_Fictiverse' if the pack isn't installed. Install the pack, restart, reload, and the error clears.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| megapixels | FLOAT | 1.00.1–100 | — |
| multiple_of | INT | 641–512 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |