ComfyUI > Nodes > ComfyUI-LexTools > ImageAspectPadNode

ComfyUI Node: ImageAspectPadNode

Class Name

ImageAspectPadNode

Category
LexTools/ImageProcessing/AspectPad
Author
SOELexicon (Account age: 4757days)
Extension
ComfyUI-LexTools
Latest Updated
2025-03-28
Github Stars
0.03K

How to Install ComfyUI-LexTools

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

ImageAspectPadNode Description

Adjusts image aspect ratio by adding padding to fit specified dimensions without distortion.

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_ratio parameter to quickly switch between landscape and portrait modes.
  • Utilize the feathering parameter 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.

ImageAspectPadNode Related Nodes

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