ComfyUI > Nodes > Allor Plugin > ImageDrawRectangle

ComfyUI Node: ImageDrawRectangle

Class Name

ImageDrawRectangle

Category
image/draw
Author
Nourepide (Account age: 2900days)
Extension
Allor Plugin
Latest Updated
2024-05-22
Github Stars
0.2K

How to Install Allor Plugin

Install this extension via the ComfyUI Manager by searching for Allor Plugin
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Allor Plugin 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

ImageDrawRectangle Description

Draw rectangles on images with ease, adding geometric shapes for visual appeal or complex designs.

ImageDrawRectangle:

The ImageDrawRectangle node is designed to help you draw rectangles on images with ease. This node is particularly useful for adding geometric shapes to your artwork, which can enhance the visual appeal or serve as a foundation for more complex designs. By using this node, you can specify the position, size, and colors of the rectangle, as well as the thickness of its outline. This flexibility allows you to create a wide range of effects, from simple borders to filled shapes with custom colors. The node is part of the image/draw category, making it a valuable tool for any AI artist looking to incorporate precise geometric elements into their creations.

ImageDrawRectangle Input Parameters:

container

This parameter represents the image on which the rectangle will be drawn. It is typically a tensor that contains the image data. The container defines the canvas size and resolution for the drawing operation.

start_x

This parameter specifies the x-coordinate of the starting point (top-left corner) of the rectangle. It determines the horizontal position of the rectangle on the image. The value should be a float between 0 and 1, where 0 represents the left edge and 1 represents the right edge of the image.

start_y

This parameter specifies the y-coordinate of the starting point (top-left corner) of the rectangle. It determines the vertical position of the rectangle on the image. The value should be a float between 0 and 1, where 0 represents the top edge and 1 represents the bottom edge of the image.

end_x

This parameter specifies the x-coordinate of the ending point (bottom-right corner) of the rectangle. It determines the horizontal extent of the rectangle on the image. The value should be a float between 0 and 1, where 0 represents the left edge and 1 represents the right edge of the image.

end_y

This parameter specifies the y-coordinate of the ending point (bottom-right corner) of the rectangle. It determines the vertical extent of the rectangle on the image. The value should be a float between 0 and 1, where 0 represents the top edge and 1 represents the bottom edge of the image.

outline_size

This parameter defines the thickness of the rectangle's outline. It is an integer value that specifies the number of pixels for the outline width. A value of 0 means no outline.

outline_red

This parameter specifies the red component of the outline color. It is an integer value between 0 and 255, where 0 represents no red and 255 represents full red.

outline_green

This parameter specifies the green component of the outline color. It is an integer value between 0 and 255, where 0 represents no green and 255 represents full green.

outline_blue

This parameter specifies the blue component of the outline color. It is an integer value between 0 and 255, where 0 represents no blue and 255 represents full blue.

outline_alpha

This parameter specifies the alpha (transparency) component of the outline color. It is a float value between 0 and 1, where 0 represents full transparency and 1 represents full opacity.

fill_red

This parameter specifies the red component of the fill color. It is an integer value between 0 and 255, where 0 represents no red and 255 represents full red.

fill_green

This parameter specifies the green component of the fill color. It is an integer value between 0 and 255, where 0 represents no green and 255 represents full green.

fill_blue

This parameter specifies the blue component of the fill color. It is an integer value between 0 and 255, where 0 represents no blue and 255 represents full blue.

fill_alpha

This parameter specifies the alpha (transparency) component of the fill color. It is a float value between 0 and 1, where 0 represents full transparency and 1 represents full opacity.

SSAA

This parameter stands for Supersample Anti-Aliasing. It is an integer value that specifies the level of anti-aliasing to be applied. Higher values result in smoother edges but require more computational resources.

method

This parameter specifies the resampling method to be used when resizing the image after drawing the rectangle. It is a string value that can be one of several predefined methods, such as "nearest", "bilinear", or "bicubic".

ImageDrawRectangle Output Parameters:

IMAGE

The output of this node is an image tensor with the drawn rectangle. This tensor can be used as input for subsequent nodes in your workflow. The output image retains the same dimensions as the input container but includes the newly drawn rectangle.

ImageDrawRectangle Usage Tips:

  • To create a border around an image, set start_x and start_y to 0, and end_x and end_y to 1, then adjust the outline_size to your desired thickness.
  • Use the fill_alpha parameter to create semi-transparent rectangles, which can be useful for overlay effects.
  • Experiment with different SSAA values to find the right balance between edge smoothness and performance.

ImageDrawRectangle Common Errors and Solutions:

"Invalid container format"

  • Explanation: The container parameter is not in the expected format.
  • Solution: Ensure that the container is a valid image tensor.

"Coordinates out of bounds"

  • Explanation: The specified coordinates for the rectangle are outside the image boundaries.
  • Solution: Make sure that start_x, start_y, end_x, and end_y are within the range of 0 to 1.

"Invalid color value"

  • Explanation: One of the color parameters is outside the acceptable range.
  • Solution: Verify that all color parameters (red, green, blue, alpha) are within their respective ranges.

"Unsupported resampling method"

  • Explanation: The specified resampling method is not recognized.
  • Solution: Use a valid resampling method such as "nearest", "bilinear", or "bicubic".

ImageDrawRectangle Related Nodes

Go back to the extension to check out more related nodes.
Allor Plugin
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.