ComfyUI > Nodes > ComfyUI 1hewNodes > Image Crop Square

ComfyUI Node: Image Crop Square

Class Name

1hew_ImageCropSquare

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 Crop Square Description

Crops images into squares, centers content, and offers padding/fill options for uniformity.

Image Crop Square:

The 1hew_ImageCropSquare node is designed to facilitate the cropping of images into square dimensions, which is particularly useful for AI artists who need to standardize image sizes for various applications. This node automatically calculates the optimal square size based on the original image dimensions and centers the crop to maintain the most important parts of the image. It also provides options for padding and filling the cropped area with specific colors or patterns, ensuring that the final output is both aesthetically pleasing and functionally appropriate for further processing or display. By using this node, you can easily prepare images for uniform presentation, which is essential in creating cohesive visual content.

Image Crop Square Input Parameters:

image

The image parameter represents the input image that you want to crop into a square. This parameter is crucial as it determines the source material from which the square crop will be derived. The image should be in a format that the node can process, typically a PIL image or a compatible format. There are no specific minimum or maximum values for this parameter, but the image should be large enough to allow for a meaningful crop.

fill_color

The fill_color parameter allows you to specify the color used to fill any padding areas around the cropped square. This can be a specific color code or a keyword such as "average" or "edge" to dynamically determine the fill based on the image content. This parameter impacts the visual appearance of the final output, especially if the cropped area does not perfectly match the desired square size. There are no strict minimum or maximum values, but the input should be a valid color representation.

extra_padding

The extra_padding parameter defines the additional padding to be added around the cropped square. This is useful for ensuring that the final image size is divisible by a certain number, which can be important for certain applications or further processing steps. The value should be a positive integer, and the default is typically set to zero if no extra padding is desired.

divisible_by

The divisible_by parameter ensures that the final size of the cropped image is a multiple of a specified number. This is particularly useful for compatibility with certain neural network architectures that require input dimensions to be divisible by specific values. The parameter should be a positive integer, with common values being powers of two.

apply_mask

The apply_mask parameter determines whether a mask should be applied to the cropped image. This can be useful for selectively cropping parts of the image based on a predefined mask, allowing for more complex and targeted cropping operations. The parameter is typically a boolean, with True indicating that a mask should be applied and False indicating that it should not.

Image Crop Square Output Parameters:

cropped_image

The cropped_image parameter is the primary output of the node, representing the final square-cropped image. This image is ready for use in further processing or display and reflects the input parameters such as fill color and padding. The cropped image maintains the central focus of the original image while adhering to the specified square dimensions.

mask_applied_image

The mask_applied_image parameter is an optional output that is generated if the apply_mask parameter is set to True. This output shows the result of the cropping operation with the mask applied, allowing for more nuanced and selective cropping results. It is particularly useful for applications that require precise control over which parts of the image are retained.

Image Crop Square Usage Tips:

  • Ensure that your input image is of sufficient resolution to allow for meaningful cropping without losing important details.
  • Use the fill_color parameter to maintain a consistent visual style across multiple images, especially when padding is necessary.
  • Adjust the extra_padding and divisible_by parameters to meet the requirements of any subsequent processing steps, such as neural network inputs.
  • Consider using the apply_mask feature for complex images where specific areas need to be retained or excluded from the crop.

Image Crop Square Common Errors and Solutions:

Image size too small

  • Explanation: The input image is too small to perform the desired crop and padding operations.
  • Solution: Use a higher resolution image or adjust the crop size and padding parameters to fit the available image dimensions.

Invalid fill color

  • Explanation: The specified fill_color is not recognized as a valid color code or keyword.
  • Solution: Ensure that the fill_color is a valid color representation, such as a hex code or a recognized keyword like "average" or "edge".

Mask application failed

  • Explanation: The apply_mask parameter is set to True, but no valid mask is provided.
  • Solution: Provide a valid mask image that matches the dimensions of the input image or set apply_mask to False if no mask is needed.

Image Crop Square 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 Crop Square