Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > Rebalance-Pack > Border Mask & Crop Detector

ComfyUI Node: Border Mask & Crop Detector

Class Name

BorderMaskDetector

Category
Rebalance-Pack/image
Author
nova452 (Account age: 1390days)
Extension
Rebalance-Pack
Latest Updated
2026-07-30
Github Stars
0.47K

How to Install Rebalance-Pack

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

Border Mask & Crop Detector Description

Detects and masks image borders based on color consistency for isolating central content efficiently.

Border Mask & Crop Detector:

The BorderMaskDetector is a specialized node designed to identify and mask the borders of an image based on color consistency. Its primary function is to detect uniform areas along the edges of an image, which can be particularly useful in scenarios where you need to isolate or highlight the central content by masking out the borders. This node operates by scanning the image's edges and comparing pixel colors to a median value, allowing it to determine where the border ends and the main content begins. By doing so, it helps in creating clean and precise masks that can be used for further image processing tasks, such as cropping or compositing. The BorderMaskDetector is beneficial for artists and designers who need to automate the process of border detection, ensuring that the focus remains on the main subject of the image without manual intervention.

Border Mask & Crop Detector Input Parameters:

image

The image parameter is the input image on which the border detection and masking will be performed. It serves as the primary data source for the node's operations. The image should be in a format compatible with the node's processing capabilities, typically a tensor representation of an RGB image.

detect_top

The detect_top parameter is a boolean flag that determines whether the top border of the image should be scanned and detected. If set to True, the node will analyze the top edge of the image to identify uniform color areas that constitute the border.

detect_bottom

The detect_bottom parameter is a boolean flag that controls the detection of the bottom border of the image. When enabled, the node will scan the bottom edge to find consistent color regions that define the border.

detect_left

The detect_left parameter is a boolean flag indicating whether the left border of the image should be detected. If True, the node will examine the left edge for uniform color areas that form the border.

detect_right

The detect_right parameter is a boolean flag that specifies whether the right border of the image should be detected. Enabling this option prompts the node to scan the right edge for consistent color regions that make up the border.

threshold

The threshold parameter is a float value that sets the minimum proportion of pixels that must match the median color to consider an area as part of the border. It ranges from 0.0 to 1.0, with a default value that typically balances sensitivity and specificity in border detection.

color_tolerance

The color_tolerance parameter defines the allowable deviation in color values when comparing pixels to the median color. It determines how strictly the node matches colors, with lower values requiring more precise matches and higher values allowing for greater variation.

max_scan_depth

The max_scan_depth parameter is a float that specifies the maximum depth, as a proportion of the image's dimension, to which the node will scan for borders. It controls how far into the image the node will look for consistent color areas, with values typically ranging from 0.0 to 1.0.

Border Mask & Crop Detector Output Parameters:

masks

The masks output parameter is a tensor that represents the detected border areas of the image. Each element in the tensor corresponds to a pixel in the input image, with values indicating whether the pixel is part of the detected border (1.0) or not (0.0). This output can be used for further image processing tasks, such as masking or compositing.

Border Mask & Crop Detector Usage Tips:

  • To achieve optimal results, adjust the threshold and color_tolerance parameters based on the image's color complexity. For images with subtle color variations, a lower color_tolerance may be necessary.
  • Use the max_scan_depth parameter to control how aggressively the node searches for borders. For images with wide borders, a higher scan depth may be beneficial.
  • Enable only the necessary border detection flags (detect_top, detect_bottom, detect_left, detect_right) to improve performance and focus on specific areas of interest.

Border Mask & Crop Detector Common Errors and Solutions:

Image format not supported

  • Explanation: The input image is not in a compatible format for processing.
  • Solution: Ensure the image is in a tensor format, typically representing an RGB image, before passing it to the node.

Threshold value out of range

  • Explanation: The threshold parameter is set outside the allowable range of 0.0 to 1.0.
  • Solution: Adjust the threshold value to be within the specified range to ensure proper operation.

Color tolerance too high

  • Explanation: The color_tolerance parameter is set too high, causing incorrect border detection.
  • Solution: Reduce the color_tolerance value to improve the accuracy of color matching during border detection.

Border Mask & Crop Detector Related Nodes

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

Border Mask & Crop Detector