|
Download README.md from OSOBONSO/MaskCropMaster: direct link, hf CLI and curl.
- Browser
- Download file 3.02 kB
-
https://huggingface.co/OSOBONSO/MaskCropMaster/resolve/main/README.md
- Command line
-
hf download hf://OSOBONSO/MaskCropMaster/README.md
-
curl -L -o README.md https://huggingface.co/OSOBONSO/MaskCropMaster/resolve/main/README.md
3.02 kB
MASK CROP MASTER β ComfyUI Custom Node
Always-square mask crop, even at image edges.
The Problem
When you mask a region at the edge of an image, the standard Mask Crop Region node from was-ns produces a rectangular crop instead of a square. This happens because it clamps the crop dimensions when the square extends beyond the image bounds.
The Solution
MASK CROP MASTER repositions the square instead of clamping it. When the crop would extend past an image edge, it slides the square inward so it always fits completely inside the image.
was-ns (rectangle): MASK CROP MASTER (square):
ββββββββββββββββββββββ ββββββββββββββββββββββ
ββββββββββββββββββββββ ββββββββββββββββββββββ
ββββββββββββββββββββββ ββββββββββββββββββββββ
ββββββββββββββββββββββ ββββββββββββββββββββββ
ββββββββββββββββββββββ ββββββββββββββββββββββ
ββββββββββββββββββββββ ββββββββββββββββββββββ
400Γ200 (broken) 400Γ400 (correct)
Installation
cd ComfyUI/custom_nodes
git clone https://huggingface.co/YOUR_USERNAME/MaskCropMaster.git
Restart ComfyUI after cloning.
Usage
Drop-in replacement for Mask Crop Region from was-ns:
- Remove the old
Mask Crop Regionnode from your workflow - Add
MASK CROP MASTERfrom theWAS Suite/Image/Maskingcategory - Connect the same inputs:
mask,padding,region_type - Connect the same outputs:
cropped_mask,crop_data, coordinates, dimensions
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
mask |
MASK | β | Input mask |
padding |
INT | 24 | Padding around the bounding box before squaring |
region_type |
COMBO | "dominant" | "dominant" or "minority" (was-ns compatible) |
Outputs
| Output | Type | Description |
|---|---|---|
cropped_mask |
MASK | Square-cropped mask |
crop_data |
CROP_DATA | Compatible with Mask Paste Region |
top_int |
INT | Y position of the square |
left_int |
INT | X position of the square |
right_int |
INT | Bottom edge |
bottom_int |
INT | Right edge |
width_int |
INT | Width (= side length) |
height_int |
INT | Height (= side length) |
Compatibility
- Works with
Mask Paste Regionfrom was-ns (samecrop_dataformat) - Same output names β minimal rewiring needed
- Tested with ComfyUI latest version
License
Apache 2.0