Nodes/ComfyUI-RyuuNoodles/Scale To Multiple 🐲
ComfyUI Node

Scale To Multiple 🐲

Scales image dimensions and/or integers to a specified multiple, with simplified controls. If no image is provided, only the width and height will be scaled. If image and width and/or height is provided, the image will use the provided dimension for scaling instead of it's own width/height. This will work as a width/height override.

By DraconicDragonΒ·Created about a year agoΒ·Updated about a month agoΒ· 11
Scale To Multiple 🐲
  • image
  • scaled_image
  • scaled_width
  • scaled_height
β—„multiple64β–Ί
β—„crop_modestretchβ–Ί
β—„resize_modelanczosβ–Ί
β—„rounding_modenearestβ–Ί
β—„scale_factor1.000β–Ί
β—„widthβ€”β–Ί
β—„heightβ€”β–Ί
CategoryRyuuNoodles 🐲/Images

Inputs (8)

NameTypeDefaultDescription
multipleINT64Multiple to scale to. Setting to 1 effectively disables this.
crop_modeCOMBOstretchCrop mode for the image. 'stretch' will stretch the image to fill the target dimensions. 'center' will center the image in the target dimensions. 'fill' will scale the image to fill the target dimensions while maintaining aspect ratio, cropping if necessary. 'uniform' will scale the image to fit within the target dimensions while maintaining aspect ratio. 'uniform fill' will scale the image to fill the target dimensions while maintaining aspect ratio, adding padding if necessary.
resize_modeCOMBOlanczosResize mode for the image. 'bilinear - tensor' is different from normal bilinear, it will use torch.nn.functional.interpolate() to resize the image and look very different from normal bilinear.
rounding_modeCOMBOnearestRounding mode for both width and height. 'nearest' will round to the nearest multiple of 'multiple' value. 'floor' will round down to the nearest multiple. 'ceil' will round up.
scale_factorFLOAT1.000How much to multiply both width and height by before scaling to multiple.
imageoptIMAGEImage to scale. If not provided, only width and height will be scaled. If either or both of the optional width/height inputs are provided, the resizing will use the given input(s).
widthoptINTOptional width to scale the image to after the multiple scaling. If no image is provided it will still output the scaled number.
heightoptINTOptional height to scale the image to after the multiple scaling. If no image is provided it will still output the scaled number.

Outputs (3)

NameTypeDescription
scaled_imageIMAGEβ€”
scaled_widthINTβ€”
scaled_heightINTβ€”