Scale Flux Image MXD
Scale to a megapixel target and skip Flux's bad sizes
- image
- IMAGE
The Flux ecosystem runs on img2img - regenerating a reference at the "right" size is half the workflows people share. And "the right size" for Flux means two things at once: roughly the megapixel count you're targeting, and ideally one of the training-bucket shapes. Scale Flux Image MXD is the pack's img2img-prep node that handles both: it scales your image to a target megapixel count while keeping aspect ratio, and if the image already lands on a Flux-safe resolution it leaves it alone.
Why the "safe" part earns its name
Flux's training buckets are a known-good list, and the pack's other nodes already encode it - the same resolutions appear in Flux Empty Latent Image MXD. This node checks your input against that exact list (in both orientations) and short-circuits: already safe → pass through untouched. No pointless resampling, no drift from a size Flux likes. For a workflow that's about keeping Flux on its home turf, that's the whole value proposition.
How it works
Identical math to the SDXL-safe sibling, and it's the clean ComfyUI megapixel formula:
scale_by = sqrt(target_pixels / (width * height))- one factor for both axes, aspect ratio preserved.- Resize with the chosen
upscale_method(bilinear default; bicubic/lanczos are the other good options). - If the input already matches a Flux-safe resolution, return it unchanged.
Like the SDXL version, it hard-rejects nearest-exact and area with an error pointing you to lanczos - a blunt but fair guard, since those methods produce visibly worse output for this job.
Inputs and outputs
- image - what you're scaling.
- total_megapixels - target as a float; default 1.0 (1MP ≈ 1024² square).
- upscale_method - bilinear / bicubic / lanczos (use these), or the two it refuses.
- Output: IMAGE, sized for a Flux generation or detail pass.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Maxed-Out-99/ComfyUI-MaxedOut.git
Restart, or ComfyUI Manager → search "Maxed Out" → install. No model downloads - plain resampling.
Troubleshooting
- "nearest-exact/area gives poor results" - the node refusing a bad choice. Pick lanczos.
- Output identical to input - already Flux-safe, so it skipped. Change the megapixel target if you truly need a different size.
- Slight aspect drift - the
round()in the pixel math can leave the output a pixel or two off exact. Harmless for img2img. - Thinking it'll add detail - it won't. This is a pixel resize (more pixels, no new information). For "bigger AND more detailed" you want a generative upscaler - SeedVR2 and friends - not this node. Know which job you're hiring for.
If your workflow is "resize a reference to Flux's happy place, then run," this is the one-liner that replaces the mental math.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| upscale_method | COMBO | bilinear | 5 options: bilinear, bicubic, lanczos, nearest-exact, area |
| total_megapixels | FLOAT | 1.000.01–128 | Set the total megapixels (e.g., 1.0 = 1 MP) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |