Visit ComfyUI Online for ready-to-use ComfyUI environment
Automatically removes black borders from images for cleaner, focused output.
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.
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.
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.
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.
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.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.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.