ImageAspectPadNode:
The ImageAspectPadNode is designed to adjust the aspect ratio of an image by adding padding, ensuring that the image fits a specified aspect ratio without distortion. This node is particularly useful for artists and designers who need to prepare images for specific display formats or compositions, where maintaining the original content's integrity is crucial. By calculating the necessary padding based on the desired aspect ratio, the node ensures that the image is centered and balanced within the new dimensions. This process is beneficial for creating uniform image sets or preparing images for platforms with strict aspect ratio requirements.
ImageAspectPadNode Input Parameters:
image
This parameter represents the input image that you want to process. It is the base image to which padding will be applied to achieve the desired aspect ratio.
aspect_ratio
This parameter specifies the target aspect ratio for the image. It is expressed as a string in the format "width:height" (e.g., "16:9"). The node uses this ratio to determine how much padding is needed to adjust the image dimensions accordingly. The default value is the first aspect ratio in the predefined list.
invert_ratio
This boolean parameter determines whether to invert the specified aspect ratio. If set to "true," the aspect ratio is inverted, effectively swapping the width and height values. This can be useful when you want to quickly switch between portrait and landscape orientations. The default value is "false."
feathering
This integer parameter controls the amount of feathering applied to the edges of the padding. Feathering creates a smooth transition between the image and the padding, which can help blend the image more naturally into its new dimensions. The default value is 0, with a minimum of 0 and a maximum defined by MAX_RESOLUTION.
left_padding
This integer parameter allows you to specify additional padding on the left side of the image. It can be used to manually adjust the image's position within the padded area. The default value is 0, with a minimum of 0 and a maximum defined by MAX_RESOLUTION.
right_padding
This integer parameter allows you to specify additional padding on the right side of the image. Similar to left_padding, it helps in manually positioning the image within the padded area. The default value is 0, with a minimum of 0 and a maximum defined by MAX_RESOLUTION.
top_padding
This integer parameter allows you to specify additional padding on the top side of the image. It is useful for adjusting the vertical position of the image within the padded area. The default value is 0, with a minimum of 0 and a maximum defined by MAX_RESOLUTION.
bottom_padding
This integer parameter allows you to specify additional padding on the bottom side of the image. It helps in adjusting the vertical position of the image within the padded area. The default value is 0, with a minimum of 0 and a maximum defined by MAX_RESOLUTION.
show_on_node
This optional integer parameter is used to control whether the node's output is displayed directly on the node interface. It is primarily for debugging or visualization purposes. The default value is 0.
ImageAspectPadNode Output Parameters:
IMAGE
This output represents the newly padded image. It maintains the original image content while adjusting the overall dimensions to fit the specified aspect ratio. The padding is added as necessary to achieve this, ensuring the image is centered and balanced.
MASK
This output provides a mask that indicates the areas of the image that have been padded. It is useful for further processing or analysis, as it clearly delineates the original image content from the added padding.
ImageAspectPadNode Usage Tips:
- To maintain the original image's orientation while adjusting its aspect ratio, use the
invert_ratioparameter to quickly switch between landscape and portrait modes. - Utilize the
featheringparameter to create a smooth transition between the image and the padding, which can enhance the visual appeal of the final output.
ImageAspectPadNode Common Errors and Solutions:
Invalid aspect ratio format
- Explanation: The aspect ratio string provided does not follow the "width:height" format.
- Solution: Ensure that the aspect ratio is specified correctly, using a colon to separate the width and height values (e.g., "16:9").
Image size mismatch
- Explanation: The input image dimensions do not match the expected format for processing.
- Solution: Verify that the input image is correctly formatted and that its dimensions are compatible with the node's requirements. Adjust the image size if necessary before processing.
