ComfyUI > Nodes > ComfyUI_CGAnimittaTools > CGA_BlackBorderCrop

ComfyUI Node: CGA_BlackBorderCrop

Class Name

CGA_BlackBorderCrop

Category
CGAnimittaTools
Author
CGAnimitta (Account age: 898days)
Extension
ComfyUI_CGAnimittaTools
Latest Updated
2025-04-11
Github Stars
0.04K

How to Install ComfyUI_CGAnimittaTools

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

CGA_BlackBorderCrop Description

Automatically removes black borders from images for cleaner, focused output.

CGA_BlackBorderCrop:

The CGA_BlackBorderCrop node is designed to automatically detect and remove black borders from images, which can be a common issue when dealing with scanned documents, photographs, or any images that have been improperly cropped. This node is particularly useful for AI artists and designers who need to clean up images for further processing or presentation. By identifying the non-black regions of an image, it effectively crops out the unnecessary black areas, resulting in a cleaner and more focused image. This process not only enhances the visual appeal of the image but also optimizes it for subsequent processing tasks, such as feature extraction or image analysis. The node operates by converting the image to grayscale, creating a binary mask to identify non-black regions, and then cropping the image to the bounding box of these regions. This ensures that the final output is free from distracting black borders, allowing the main content of the image to stand out.

CGA_BlackBorderCrop Input Parameters:

image

The image parameter is the primary input for the node, representing the image from which black borders need to be removed. This parameter accepts an image in tensor format, which is then processed to identify and crop out black borders. The quality and resolution of the input image can impact the effectiveness of the border removal process, so it is advisable to use high-quality images for optimal results.

threshold

The threshold parameter determines the sensitivity of the node in detecting black regions within the image. It is an integer value that ranges from 0 to 255, with a default value of 10. A lower threshold value makes the node more sensitive to darker shades, potentially identifying more areas as black, while a higher threshold may result in less sensitivity, possibly leaving some dark areas uncropped. Adjusting this parameter allows you to fine-tune the node's performance based on the specific characteristics of the image being processed.

CGA_BlackBorderCrop Output Parameters:

IMAGE

The output of the CGA_BlackBorderCrop node is an IMAGE that has been processed to remove black borders. This output is a tensor format image that retains the original content but without the distracting black edges. The cropped image is ready for further use in your projects, whether for display, analysis, or additional processing steps. The effectiveness of the cropping is dependent on the input parameters, particularly the threshold setting, which influences the detection of black regions.

CGA_BlackBorderCrop Usage Tips:

  • Adjust the threshold parameter to better suit the specific lighting and contrast conditions of your image. A lower threshold can help in cases where the black border is not entirely black but rather a dark shade.
  • Ensure that the input image is of good quality and resolution to achieve the best results, as low-quality images may lead to inaccurate border detection.

CGA_BlackBorderCrop Common Errors and Solutions:

Image format not supported

  • Explanation: The input image is not in a supported format or is not properly converted to a tensor.
  • Solution: Ensure that the image is correctly formatted as a tensor before inputting it into the node. You may need to preprocess the image using appropriate libraries to convert it to the required format.

No bounding box found

  • Explanation: The node could not detect any non-black regions within the image, possibly due to an incorrect threshold setting.
  • Solution: Adjust the threshold parameter to a lower value to increase sensitivity and try again. If the image is entirely black, consider using a different image or preprocessing it to enhance contrast.

CGA_BlackBorderCrop Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI_CGAnimittaTools
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 Playground, enabling artists to harness the latest AI tools to create incredible art.