ComfyUI > Nodes > ComfyUI 1hewNodes > Image Edge Crop/Pad

ComfyUI Node: Image Edge Crop/Pad

Class Name

1hew_ImageEdgeCropPad

Category
1hewNodes/image/crop
Author
1hew (Account age: 1113days)
Extension
ComfyUI 1hewNodes
Latest Updated
2026-04-17
Github Stars
0.03K

How to Install ComfyUI 1hewNodes

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

Image Edge Crop/Pad Description

Adjusts image edges by cropping or padding, with color options, for specific dimensions.

Image Edge Crop/Pad:

The 1hew_ImageEdgeCropPad node is designed to manipulate the edges of an image by either cropping or padding them. This node is particularly useful for adjusting the dimensions of an image to meet specific requirements, such as ensuring compatibility with certain display resolutions or preparing images for further processing. By allowing you to specify the amount of cropping or padding on each side of the image, this node provides a high degree of control over the final appearance of the image. The node can fill the padded areas with a specified color or use the average color of the image edges, making it versatile for various artistic and technical applications. Its ability to handle images in a batch and maintain the aspect ratio by ensuring dimensions are divisible by a specified number further enhances its utility.

Image Edge Crop/Pad Input Parameters:

image

This parameter represents the input image that you want to process. It should be provided as a tensor, and the node will perform cropping or padding operations based on the other parameters specified.

uniform_amount

This parameter allows you to specify a uniform amount of cropping or padding to be applied to all sides of the image. It accepts a float value with a default of 0.0, and it can range from negative to positive values, where negative values crop the image and positive values pad it.

top_amount

This parameter specifies the amount of cropping or padding to be applied to the top edge of the image. It accepts a float value with a default of 0.0, and it can range from negative to positive values, similar to uniform_amount.

bottom_amount

This parameter specifies the amount of cropping or padding to be applied to the bottom edge of the image. It accepts a float value with a default of 0.0, and it can range from negative to positive values.

left_amount

This parameter specifies the amount of cropping or padding to be applied to the left edge of the image. It accepts a float value with a default of 0.0, and it can range from negative to positive values.

right_amount

This parameter specifies the amount of cropping or padding to be applied to the right edge of the image. It accepts a float value with a default of 0.0, and it can range from negative to positive values.

pad_color

This parameter determines the color used to fill the padded areas of the image. It accepts a string value, with a default of "0.0", which can be interpreted as a grayscale value or a color code depending on the context.

divisible_by

This parameter ensures that the final dimensions of the image are divisible by a specified integer. It accepts an integer value with a default of 8, and it can range from 1 to 1024. This is useful for maintaining compatibility with certain processing requirements.

Image Edge Crop/Pad Output Parameters:

image

This output parameter provides the processed image after the cropping or padding operations have been applied. The image is returned as a tensor, ready for further use or display.

mask

This output parameter provides a mask indicating the areas of the image that were affected by the cropping or padding operations. It is useful for understanding which parts of the image were modified and can be used for further processing or analysis.

Image Edge Crop/Pad Usage Tips:

  • To maintain the aspect ratio of your image while padding, ensure that the divisible_by parameter is set to a value that aligns with your target resolution requirements.
  • Use the pad_color parameter to match the padding color with the dominant colors in your image for a seamless appearance.
  • When cropping, negative values for the uniform_amount or specific edge amounts can help focus on a particular area of interest within the image.

Image Edge Crop/Pad Common Errors and Solutions:

Image tensor is None

  • Explanation: This error occurs when the input image tensor is not provided or is invalid.
  • Solution: Ensure that a valid image tensor is passed to the node as input.

Invalid pad color format

  • Explanation: This error arises when the pad_color parameter is not in a recognized format.
  • Solution: Verify that the pad_color is specified correctly, using a valid grayscale value or color code.

Dimension not divisible by specified value

  • Explanation: This error occurs when the final image dimensions are not divisible by the divisible_by parameter.
  • Solution: Adjust the divisible_by parameter or the cropping/padding amounts to ensure compatibility with the specified divisibility requirement.

Image Edge Crop/Pad Related Nodes

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

Image Edge Crop/Pad