Visit ComfyUI Online for ready-to-use ComfyUI environment
Scale input image to fit specified bounding box while maintaining aspect ratio, with alignment options.
The Image Scale Bounding Box node is designed to scale an input image to fit within a specified bounding box while maintaining the original aspect ratio. This node is particularly useful for resizing images to fit within a defined space without distorting the image. It ensures that the image is scaled proportionally and can add padding to fill any remaining space, allowing for a centered, top, left, right, or bottom alignment. This functionality is essential for AI artists who need to prepare images for various display formats or further processing steps, ensuring that the images retain their visual integrity and are presented consistently.
This parameter represents the input image that you want to scale. The image should be in a format that the node can process, typically a tensor representation of the image data.
This parameter determines the method used for scaling the image. The available options are lanczos
, nearest-exact
, bilinear
, area
, and bicubic
. Each method has its own characteristics in terms of quality and computational complexity. For example, lanczos
provides high-quality results but is computationally intensive, while nearest-exact
is faster but may produce lower quality results. The default value is lanczos
.
This parameter specifies the width of the bounding box in which the image will be scaled. The value must be an integer between 1 and the maximum resolution supported by the system. The default value is 512.
This parameter specifies the height of the bounding box in which the image will be scaled. The value must be an integer between 1 and the maximum resolution supported by the system. The default value is 512.
This parameter defines how the padding should be applied if the scaled image does not completely fill the bounding box. The options are none
, center
, top
, left
, right
, and bottom
. Choosing none
will not add any padding, while the other options will align the image accordingly within the bounding box and fill the remaining space with the specified padding color. The default value is none
.
This parameter sets the color of the padding that will be added if the image does not fill the bounding box. The value is an integer representing the color in hexadecimal format (e.g., 0xFFFFFF for white). The default value is 0 (black).
The output is the scaled image that fits within the specified bounding box while maintaining its original aspect ratio. If padding is applied, the output image will also include the padding in the specified color. This ensures that the image is ready for display or further processing without any distortion.
lanczos
upscale method for the highest quality results, especially when working with detailed images.padding
parameter to center
to ensure the image is centered within the bounding box, which is useful for creating visually balanced compositions.pad_color
to match the background or theme of your project to create a seamless look when padding is applied.Invalid upscale method
upscale_method
parameter is set to one of the following: lanczos
, nearest-exact
, bilinear
, area
, or bicubic
.Box dimensions out of range
box_width
or box_height
is outside the allowed range.box_width
and box_height
parameters are set to values between 1 and the maximum resolution supported by your system.Invalid padding option
padding
parameter is set to one of the following: none
, center
, top
, left
, right
, or bottom
.Invalid pad color
pad_color
parameter is set to a valid integer representing a color in hexadecimal format, within the range of 0 to 0xFFFFFF.© Copyright 2024 RunComfy. All Rights Reserved.