Visit ComfyUI Online for ready-to-use ComfyUI environment
Resize images while preserving aspect ratio with various scaling options for accurate and efficient image preparation.
The LayerUtility: ImageScaleByAspectRatio V2 node is designed to help you resize images while maintaining their aspect ratio. This node is particularly useful when you need to scale images to fit specific dimensions without distorting their original proportions. It offers various scaling options, such as scaling to the longest or shortest side, width, height, or even a specific total pixel count. This flexibility ensures that your images are resized accurately and efficiently, making it an essential tool for AI artists who need to prepare images for different applications or outputs.
This parameter determines the aspect ratio to be used for scaling the image. You can choose between 'original' to maintain the original aspect ratio, 'custom' to specify a custom ratio, or provide a specific ratio in the format 'width:height'. This setting ensures that the image is scaled correctly according to the desired proportions.
When using a custom aspect ratio, this parameter specifies the width component of the ratio. It works in conjunction with proportional_height
to define the custom aspect ratio. This allows for precise control over the image's final dimensions.
Similar to proportional_width
, this parameter specifies the height component of the custom aspect ratio. Together, these parameters allow you to define a specific aspect ratio for scaling the image.
This parameter determines how the image should fit within the target dimensions. Options may include 'contain', 'cover', or other fitting methods. This setting ensures that the image is resized appropriately without unwanted cropping or padding.
This parameter specifies the resampling method to be used during the scaling process. Options include 'LANCZOS', 'bicubic', 'hamming', 'bilinear', 'box', and 'nearest'. Each method offers different levels of quality and performance, allowing you to choose the best option for your specific needs.
This parameter allows you to round the target dimensions to a specific multiple. For example, setting this to 10 will round the width and height to the nearest multiple of 10. This can be useful for ensuring that the resized image dimensions are compatible with certain requirements or constraints.
This parameter determines which side of the image should be scaled to the specified length. Options include 'longest', 'shortest', 'width', 'height', and 'total_pixel(kilo pixel)'. This setting provides flexibility in how the image is resized, ensuring that it meets your specific requirements.
This parameter specifies the target length for the side chosen in scale_to_side
. It defines the final dimension for the selected side, ensuring that the image is scaled accurately.
This parameter accepts the input image to be scaled. It is the primary image that will be resized according to the specified parameters.
This optional parameter accepts a mask image that will be scaled along with the primary image. This ensures that any associated masks are resized consistently with the main image.
The primary output of this node is the resized image. This image has been scaled according to the specified parameters, maintaining the desired aspect ratio and fitting within the target dimensions.
If a mask image was provided as an input, this output will contain the resized mask. The mask is scaled consistently with the primary image, ensuring that any regions of interest are accurately represented.
aspect_ratio
parameter to 'original'.scale_to_side
and scale_to_length
parameters to precisely control the final dimensions of the image.method
parameter to find the best balance between quality and performance for your specific use case.round_to_multiple
parameter to achieve this.© Copyright 2024 RunComfy. All Rights Reserved.