ComfyUI Node
Image Scale
Scale an image and its mask together to a target size. Pick by-long-side, by-short-side or a custom size, then stretch, crop, fill with a colour / border colour / edge pixels, or fit a total pixel count. Interpolation, anchor, a run condition, the fill colour and a multiple-of rounding are all adjustable. Both image and mask are optional but at least one has to be connected; a mask alone outputs a black placeholder image. The returned width and height feed straight into size inputs, and every parameter lines up with Goohaitools Image Scale V2 so the same numbers can be pasted between the two nodes.
Image Scale
- image
- mask
- image
- width
- height
- mask
◄width512►
◄height512►
◄scale_methodby-long-side►
◄edge_size1024►
◄interpolationlanczos►
◄scale_modecrop►
◄anchorcenter►
◄conditionalways►
◄fill_color#364254►
◄multiple_of0►
CategoryQG-tools/Image
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 5120–100000 | Target width in custom-size mode; 0 derives it from the height. Ignored by the by-long-side / by-short-side methods. |
| height | INT | 5120–100000 | Target height in custom-size mode; 0 derives it from the width. Ignored by the by-long-side / by-short-side methods. |
| scale_method | COMBO | by-long-side | by-long-side / by-short-side: apply the edge length below to the long or the short side. custom-size: use the width and height above. |
| edge_size | INT | 102464–100000 | Target edge length in pixels for the proportional methods (1024 in the original node). Also used by the when-long-side-greater / when-short-side-smaller conditions. |
| interpolation | COMBO | lanczos | Resampling filter. The image and the mask are resampled with the same filter, matching Goohaitools Image Scale V2. |
| scale_mode | COMBO | crop | stretch / crop / three fill modes / total pixels. Note: with by-long-side or by-short-side and multiple_of <= 1 this is not used at all (the original node behaves the same way). |
| anchor | COMBO | center | Which side survives a crop or a fill: center / top / bottom / left / right. |
| condition | COMBO | always | Run always, or only when the long side is greater / the short side is smaller than the target. Otherwise the input passes through unchanged (multiple_of may still adapt the size). |
| fill_color | STRING | #364254 | Canvas colour for the fill-color mode, as #RRGGBB (default #364254). Click the swatch on the node to pick one or type the hex; the original node writes the same string. |
| multiple_of | INT | 00–256 | Round the final width and height up to a multiple of this number (0 or 1 means no rounding). Each scale mode rounds in its own direction, matching the original node. |
| imageopt | IMAGE | The image batch to scale, standard [B,H,W,C]. Optional: with only a mask connected the image output is a black placeholder. | |
| maskopt | MASK | The mask to scale together with the image. Not connected gives an all-black mask; a single frame is repeated to match a multi-frame image. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| width | INT | — |
| height | INT | — |
| mask | MASK | — |