Visit ComfyUI Online for ready-to-use ComfyUI environment
Resize images while maintaining aspect ratio, with customizable target dimensions and rounding options for visual integrity.
The LayerUtility: ImageScaleByAspectRatio node is designed to help you resize images while maintaining their aspect ratio. This is particularly useful when you need to scale images to fit specific dimensions without distorting their original proportions. The node offers various methods to determine the target dimensions, such as scaling to the longest or shortest side, width, height, or even a specific number of pixels. Additionally, it provides options to round the dimensions to a multiple of a specified value, ensuring that the resized images meet your exact requirements. This node is essential for AI artists who need to prepare images for further processing or display, as it ensures that the images retain their visual integrity.
This parameter determines the aspect ratio to be used for scaling the image. It can be set to original
to maintain the original aspect ratio of the image, custom
to use a user-defined aspect ratio, or a specific ratio in the format width:height
. The aspect ratio affects how the image will be resized, ensuring that the proportions are kept consistent.
When the aspect_ratio
is set to custom
, this parameter specifies the width component of the custom aspect ratio. It works in conjunction with proportional_height
to define the desired aspect ratio.
When the aspect_ratio
is set to custom
, this parameter specifies the height component of the custom aspect ratio. It works in conjunction with proportional_width
to define the desired aspect ratio.
This parameter determines how the image should be resized to fit within the target dimensions. Options include contain
, which scales the image to fit within the dimensions while maintaining the aspect ratio, and cover
, which scales the image to cover the entire dimensions, potentially cropping parts of the image.
This parameter specifies the resampling method to be used for resizing the image. Options include LANCZOS
, bicubic
, hamming
, bilinear
, box
, and nearest
. Each method offers different trade-offs between quality and performance.
This parameter allows you to round the target dimensions to a multiple of a specified value. This is useful for ensuring that the resized images meet specific size requirements. If set to None
, no rounding is applied.
This boolean parameter determines whether the image should be scaled to the longest side. If set to True
, the image will be resized such that the longest side matches the specified longest_side
value.
When scale_to_longest_side
is set to True
, this parameter specifies the target length for the longest side of the image. The other dimension will be scaled proportionally to maintain the aspect ratio.
This parameter accepts the input image to be resized. It is typically provided as a tensor.
This optional parameter accepts a mask image to be resized along with the main image. It ensures that both the image and the mask maintain the same dimensions and aspect ratio.
The resized image is the main output of the node. It is the input image scaled to the target dimensions while maintaining the specified aspect ratio. The output is typically provided as a tensor.
If a mask was provided as an input, the resized mask is the output. It is the input mask scaled to the same dimensions as the resized image, ensuring consistency between the image and the mask.
aspect_ratio
parameter to original
.fit
parameter to control how the image fits within the target dimensions. Contain
is useful for ensuring the entire image is visible, while cover
is better for filling the entire space.method
parameter to find the best balance between quality and performance for your specific use case.round_to_multiple
parameter to achieve this.aspect_ratio
parameter was set to a value that does not follow the width:height
format.aspect_ratio
is specified in the correct format, such as 16:9
or 4:3
.method
parameter was set to a value that is not supported.LANCZOS
, bicubic
, hamming
, bilinear
, box
, or nearest
.image
parameter was not provided, or the mask
parameter was expected but not provided.round_to_multiple
parameter was set to a non-integer value.round_to_multiple
parameter is set to an integer value or None
.© Copyright 2024 RunComfy. All Rights Reserved.