ImageScaleToNormPixels
Resize to an exact megapixel target without dragging a VAE into it
- pixels
- mask
- image
- mask
ComfyUI core's ImageScaleToTotalPixels is a workhorse - Comfy Org's own February 2026 handbook recommends downscaling an input to 0.35 megapixels with it before a SeedVR2 upscale. But it has one habit that's a pain when you only want pixels: it wants to hand you latents too. ImageScaleToNormPixels is the stripped-down version from the comfyui-ysnodes pack that scales an image (and an optional mask) to a target size and stops there. No VAE, no latent outputs, nothing to wire into a sampler. If the next node in your chain wants an IMAGE, this is the one.
It lives in a small pack by Mr. Yassin NM that is exactly what it claims to be: a grab-bag of self-contained ComfyUI utility nodes with zero external dependencies. This one is "NormPixels" as in normalized pixels - the version that normalizes your image size without normalizing it into latent space.
How it works
The scaling is a two-step pipeline, and each step is optional:
scale_bymultiplies the image's current size.1.0= unchanged,1.5= 50% bigger,0.5= half. This runs first.megapixels- ifenable_megapixelsis on - rescales the result of step one sowidth × height ≈ megapixels × 1,048,576, keeping the aspect ratio.1.0≈ 1024×1024,1.5≈ 1024×1536.
Both steps snap the final dimensions to the nearest multiple (default 8, which is the VAE-safe rounding you'll hear repeated everywhere in this ecosystem). The mask, when connected, goes through the exact same steps so image and mask always land on matching dimensions. Leave the mask unconnected and you get zeros back.
The inputs that matter
You'll actually touch three of them:
scale_by- a plain multiplier. This is the input the coreImageScaleToTotalPixelsdoesn't have; this pack adds it so you can do "make it 1.25×" without math.megapixels- your resolution target, in the units every modern workflow talks in.enable_megapixels- the switch between "use the scale_by result as-is" and "then force it to the megapixel target."
And there's a genuinely useful passthrough hiding in here: scale_by = 1.0 with enable_megapixels = false passes the image through unchanged, byte-for-byte. That makes it a neat conditional choke point - flip one toggle and the whole sizing behavior switches on or off without rewiring.
Installing it
The pack has no model downloads and no Python dependencies beyond what ComfyUI already ships - requirements.txt is literally a comment saying "no additional pip packages required." So install is painless either way:
ComfyUI Manager: search for comfyui-ysnodes and hit install.
Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/MrYassinox/comfyui-ysnodes.git
Restart ComfyUI and the node appears under YSNodes/image in the menu.
Where people get burned
The obvious one: this node gives you image and mask only. If you connect its output to a KSampler expecting a latent, nothing works - reach for the pack's ImageScaleToTotalPixels (or Size Picker Full) when you need the latent side of the same operation. The two are easy to confuse because they're siblings in the same folder with near-identical names; the tell is that TotalPixels has a vae input and extra latent_image/latent_mask outputs. NormPixels is the one you want for feeding conditioning inputs, ControlNet preprocessors, previews, or any node that operates on raw pixels.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| pixels | IMAGE | Input image to scale. | |
| upscale_method | COMBO | lanczos | Interpolation method used when scaling. |
| scale_by | FLOAT | 1.000.01–8 | Multiplies the image's current size. 1.0 = unchanged. 1.5 = 50% bigger. 0.5 = half size. Applied before the megapixels step below. |
| megapixels | FLOAT | 1.000.01–64 | Target resolution in megapixels, applied after scale_by. The image is scaled so width × height ≈ megapixels × 1,048,576, preserving the original aspect ratio. Example: 1.0 ≈ 1024×1024, 1.5 ≈ 1024×1536. Only takes effect when enable_megapixels=True. |
| multiple | INT | 88–128 | Nearest multiple to round scaled width/height to (applies to both scale_by and megapixels). 8 = VAE-safe (recommended). |
| enable_megapixels | BOOLEAN | true | When True → further scale the scale_by result to target megapixels. When False → use the scale_by result as-is, no megapixels constraint. |
| maskopt | MASK | Optional mask. Goes through the same scale_by + megapixels steps as the image. Returns zeros when not connected. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |