Add Margin With Color:
The Add Margin With Color node is designed to enhance your images by adding a customizable margin around them. This node allows you to specify the size of the margin as a percentage of the image's height and choose whether the margin should be added to the top or bottom of the image. Additionally, you can select the color of the margin, opting for either black or white. This functionality is particularly useful for creating a uniform look across a series of images or for preparing images for presentations or publications where a consistent border is desired. By using this node, you can easily adjust the visual framing of your images without needing to manually edit each one, saving time and ensuring consistency.
Add Margin With Color Input Parameters:
image
This parameter represents the input image to which the margin will be added. It is the primary content that will be processed by the node.
margin_pct
This parameter specifies the size of the margin as a percentage of the image's height. The default value is 10, with a minimum of 0 and a maximum of 100. Adjusting this value will increase or decrease the margin size proportionally to the image's height, allowing for precise control over the margin's appearance.
top
This boolean parameter determines the position of the margin. If set to true, the margin will be added to the top of the image; if false, it will be added to the bottom. The default setting is false, meaning the margin is added to the bottom unless specified otherwise.
black
This boolean parameter allows you to choose the color of the margin. When set to true, the margin will be black; when set to false, it will be white. The default is true, providing a black margin unless you opt for a white one.
Add Margin With Color Output Parameters:
OUTPUT_IMAGE
This output parameter provides the resulting image with the added margin. It includes the original image content along with the newly added margin, either at the top or bottom, depending on the input settings.
MASK
The MASK output is a binary mask that indicates the areas of the original image and the margin. It is useful for further image processing tasks where distinguishing between the original content and the added margin is necessary.
Add Margin With Color Usage Tips:
- To create a consistent look across multiple images, use the same
margin_pctvalue for each image. - If you want to highlight the top of an image, set the
topparameter to true to add the margin at the top. - Use the
blackparameter to switch between black and white margins, depending on the background or theme of your project.
Add Margin With Color Common Errors and Solutions:
Image shape mismatch
- Explanation: This error occurs when the input image does not have the expected shape or dimensions.
- Solution: Ensure that the input image is in the correct format and dimensions expected by the node, typically a 4D tensor with shape (1, height, width, 3).
Invalid margin percentage
- Explanation: This error arises when the
margin_pctvalue is set outside the allowed range of 0 to 100. - Solution: Adjust the
margin_pctvalue to be within the valid range, ensuring it is not less than 0 or greater than 100.
