ComfyUI > Nodes > ComfyUI > Bounding Box

ComfyUI Node: Bounding Box

Class Name

PrimitiveBoundingBox

Category
utils/primitive
Author
ComfyAnonymous (Account age: 763days)
Extension
ComfyUI
Latest Updated
2026-05-13
Github Stars
112.77K

How to Install ComfyUI

Install this extension via the ComfyUI Manager by searching for ComfyUI
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI 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
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Bounding Box Description

Utility tool for defining rectangular regions within a space, simplifying tasks like cropping and object detection in image processing.

Bounding Box:

The PrimitiveBoundingBox node is a utility tool designed to define a rectangular region within a given space, typically used in image processing or graphical applications. This node allows you to specify a bounding box by setting its position and dimensions, which can be crucial for tasks such as cropping, object detection, or defining areas of interest within an image. By providing a straightforward method to create bounding boxes, it simplifies the process of managing spatial regions, making it easier to manipulate and analyze specific parts of an image or graphical interface. The node's primary goal is to offer a flexible and efficient way to handle bounding boxes, ensuring that you can focus on the creative aspects of your work without getting bogged down by technical complexities.

Bounding Box Input Parameters:

x

The x parameter specifies the horizontal position of the top-left corner of the bounding box. It determines how far from the left edge of the image or canvas the bounding box will start. The value must be a non-negative integer, with a minimum of 0 and a maximum defined by the system's maximum resolution. The default value is 0, meaning the bounding box will start at the leftmost edge unless specified otherwise.

y

The y parameter defines the vertical position of the top-left corner of the bounding box. It indicates how far from the top edge of the image or canvas the bounding box will begin. Similar to the x parameter, it must be a non-negative integer, with a minimum of 0 and a maximum determined by the system's maximum resolution. The default value is 0, placing the bounding box at the topmost edge unless adjusted.

width

The width parameter sets the horizontal size of the bounding box. It determines how wide the bounding box will be, starting from the x position. The width must be at least 1 and can go up to the system's maximum resolution. The default width is 512, providing a moderate size that can be adjusted to fit specific needs.

height

The height parameter specifies the vertical size of the bounding box. It controls how tall the bounding box will be, starting from the y position. The height must be at least 1 and can extend up to the system's maximum resolution. The default height is 512, offering a balanced size that can be modified as required.

Bounding Box Output Parameters:

BoundingBox

The output of the PrimitiveBoundingBox node is a dictionary containing the x, y, width, and height values that define the bounding box. This output is crucial for subsequent operations that require precise spatial definitions, such as cropping images, detecting objects, or applying effects to specific regions. By providing these parameters in a structured format, the node ensures that you can easily integrate the bounding box into your workflow and apply it to various tasks.

Bounding Box Usage Tips:

  • Ensure that the x and y parameters are set within the bounds of your image or canvas to avoid errors or unexpected results.
  • Adjust the width and height parameters according to the specific area you want to focus on, keeping in mind the maximum resolution limits.
  • Use the bounding box output in conjunction with other nodes that require spatial definitions to enhance your image processing tasks.

Bounding Box Common Errors and Solutions:

"Invalid bounding box dimensions"

  • Explanation: This error occurs when the width or height parameters are set to values less than 1 or exceed the maximum resolution.
  • Solution: Ensure that both width and height are set to valid values within the allowed range.

"Bounding box position out of bounds"

  • Explanation: This error happens when the x or y parameters are set to values that place the bounding box outside the image or canvas boundaries.
  • Solution: Adjust the x and y parameters to ensure the bounding box is positioned within the valid area of the image or canvas.

Bounding Box Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Bounding Box