2.0 KiB
2.0 KiB
ImageMegapixelSelector
ImageMegapixelSelector resizes images to hit a target megapixel budget. It’s a quick way to keep batches inside memory limits or align images with downstream models that expect a specific pixel count.
Inputs
image– The photo to resize.target_megapixels– Desired image size measured in megapixels (e.g.,1.5equals 1.5 million pixels).clamp_min_megapixels– Prevent downsizing below this value; useful when you only want to shrink oversize images.round_dimensions– Choose how the node rounds width and height:Evenkeeps both dimensions even.Multiple of 64suits latent models that require divisible sizes.Nonekeeps the exact float result.
keep_aspect– WhenTrue, scale both sides evenly; whenFalse, allow separate width/height scaling to hit the target precisely.
Outputs
image– Resized image tensor.width,height– New dimensions in pixels.scale_factor– Multiplier applied to the original size.
Where It Fits
Use the node before memory-heavy diffusion or upscaling steps when you need to guarantee each frame stays under a certain size. It’s also handy for standardising mixed-source reference sets so later processing behaves consistently.
Tuning Tips
- Enable
keep_aspectto avoid distortion; only disable it if you plan to crop afterward. - Choose
Multiple of 64rounding for Stable Diffusion checkpoints, orEvenfor general-purpose pipelines. - Set
clamp_min_megapixelsto the same value astarget_megapixelswhen you only ever want to downscale oversized inputs.
Troubleshooting
- Image still too big – Lower the target megapixels or check that
keep_aspectisn’t preventing the exact resize you need. - Image looks stretched – Make sure
keep_aspectis enabled unless non-uniform scaling is intentional. - Model rejects dimensions – Adjust the rounding mode to satisfy the model’s width/height requirements.
Screenshot: docs/screenshots/image_megapixel_selector.png