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

Scale To Multiple Adv. 🐲

Scales image dimensions and/or integers to a specified multiple, with options for rounding mode and pre-scaling. 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 Adv. 🐲
  • image
  • scaled_image
  • scaled_width
  • scaled_height
β—„multiple64β–Ί
β—„crop_modestretchβ–Ί
β—„resize_modelanczosβ–Ί
β—„rounding_mode_widthnearestβ–Ί
β—„rounding_mode_heightnearestβ–Ί
β—„scale_factor_width1.000β–Ί
β—„scale_factor_height1.000β–Ί
β—„widthβ€”β–Ί
β—„heightβ€”β–Ί
CategoryRyuuNoodles 🐲/Images

Inputs (10)

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_mode_widthCOMBOnearestRounding mode for width. 'nearest' will round to the nearest multiple of 'multiple' value. 'floor' will round down to the nearest multiple. 'ceil' will round up.
rounding_mode_heightCOMBOnearestRounding mode for height. 'nearest' will round to the nearest multiple of 'multiple' value. 'floor' will round down to the nearest multiple. 'ceil' will round up.
scale_factor_widthFLOAT1.000How much to multiply width by before scaling to multiple.
scale_factor_heightFLOAT1.000How much to multiply 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β€”