ImageScaleToTotalPixels_motorway_edition
Resize to a megapixel target, aspect ratio kept
- MOTORWAY 🚌💨
- MOTORWAY 🚌💨
Here's a nicer way to think about resizing: "make this about a million pixels" instead of "make this 1024x1024." That's the whole idea behind ImageScaleToTotalPixels - you set a pixel budget and the node figures out the dimensions, keeping the aspect ratio intact. ImageScaleToTotalPixels_motorway_edition is that node, wrapped for the MOTORWAY 🚌💨 pipe in agilly1989/ComfyUI_agilly1989_motorway.
It reads the image out of the pipe under INPUT_image_key (default "image"), scales it to the target megapixel count, and stores the result back under OUTPUT_IMAGE_key (default "IMAGE"). Only visible output is the Motorway pipe.
Inputs that matter
INPUT_image_key(default"image") - pipe key of the sourceupscale_method-nearest-exact,bilinear,area,bicubic,lanczosmegapixels(FLOAT, 0.01 to 16, default 1) - the target total pixel countOUTPUT_IMAGE_key(default"IMAGE") - where the scaled image lands
megapixels is width × height in millions, so 1.0 is roughly a 1024×1024-class image, 2.0 is ~2MP, and so on. The node preserves aspect, so a portrait source and a landscape source both land at the same total count with different dimensions. For "just make it bigger without inventing detail," lanczos is the honest interpolator - fast, predictable, adds no content. If you need exact dimensions instead, use the pack's ImageScale; if you want a clean multiplier, use ImageScaleBy.
How it works
Standard clone mechanics: pop the Motorway, pull the image via the input key, run stock ImageScaleToTotalPixels with upscale_method and megapixels, store the result under the output key, and return a cloned pipe so nothing upstream is mutated.
Installing
cd ComfyUI/custom_nodes
git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway
Restart ComfyUI, or search "motorway" in ComfyUI Manager. Pure Python, no requirements.txt, no model downloads.
Gotchas
Keys are exact and case-sensitive; a 'MotorwayClass' object has no attribute 'hash_' error means your key string doesn't match anything in the pipe. And the usual case trap - read "image" (lowercase), write "IMAGE" (uppercase) - so chained clones need keys you set to agree. Family status as ever: BETA, with the motorway_edition clones disabled in the 1.1.7 hotfix - if the node's missing from your menu, stock ImageScaleToTotalPixels is the same tool with wires.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — | |
| INPUT_image_key | STRING | image | — |
| upscale_method | COMBO | 5 options: nearest-exact, bilinear, area, bicubic, lanczos | |
| megapixels | FLOAT | 1.000.01–16 | — |
| OUTPUT_IMAGE_key | STRING | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MOTORWAY 🚌💨 | MOTORWAY 🚌💨 | — |