ComfyUI > Nodes > ComfyUI-Hangover-Nodes > Image Scale Bounding Box

ComfyUI Node: Image Scale Bounding Box

Class Name

Image Scale Bounding Box

Category
Hangover
Author
Hangover3832 (Account age: 640days)
Extension
ComfyUI-Hangover-Nodes
Latest Updated
2024-06-14
Github Stars
0.03K

How to Install ComfyUI-Hangover-Nodes

Install this extension via the ComfyUI Manager by searching for ComfyUI-Hangover-Nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-Hangover-Nodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Image Scale Bounding Box Description

Scale input image to fit specified bounding box while maintaining aspect ratio, with alignment options.

Image Scale Bounding Box:

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.

Image Scale Bounding Box Input Parameters:

image

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.

upscale_method

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.

box_width

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.

box_height

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.

padding

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.

pad_color

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).

Image Scale Bounding Box Output Parameters:

IMAGE

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.

Image Scale Bounding Box Usage Tips:

  • Use the lanczos upscale method for the highest quality results, especially when working with detailed images.
  • Set the padding parameter to center to ensure the image is centered within the bounding box, which is useful for creating visually balanced compositions.
  • Adjust the pad_color to match the background or theme of your project to create a seamless look when padding is applied.

Image Scale Bounding Box Common Errors and Solutions:

Invalid upscale method

  • Explanation: The specified upscale method is not one of the allowed options.
  • Solution: Ensure that the upscale_method parameter is set to one of the following: lanczos, nearest-exact, bilinear, area, or bicubic.

Box dimensions out of range

  • Explanation: The specified box_width or box_height is outside the allowed range.
  • Solution: Verify that the box_width and box_height parameters are set to values between 1 and the maximum resolution supported by your system.

Invalid padding option

  • Explanation: The specified padding option is not recognized.
  • Solution: Ensure that the padding parameter is set to one of the following: none, center, top, left, right, or bottom.

Invalid pad color

  • Explanation: The specified pad color is not a valid integer or is out of the acceptable range.
  • Solution: Ensure that the pad_color parameter is set to a valid integer representing a color in hexadecimal format, within the range of 0 to 0xFFFFFF.

Image Scale Bounding Box Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-Hangover-Nodes
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.