Mask Cover Four Corners
Generate a corner mask, built for stripping watermarks
- size_as
- MASK
A lot of images pulled off the open web - stock photo previews, screenshots, scraped reference images - carry a logo or watermark stamped into one corner. MaskCoverFourCorners generates a mask covering exactly that: a rounded blob in whichever corner(s) you pick, purpose-built to feed into an inpaint or attention-masking step and make that stamp disappear.
What it's for
The README is explicit about the intended use: "This mask can be used as an attention mask to remove watermarks from the corners." Rather than hand-painting a mask over a logo every time you pull in a reference image with one baked in, generate it procedurally - pick the corner, pick the size, done. It's also generally useful any time you specifically want to affect a corner region and nothing else: vignette-style edits, corner-only inpainting, watermark removal being the obvious headline case.
How it works
It draws a circular-edged shape anchored in whichever corner(s) you enable, sized by radius, against a canvas of your specified width/height. Multiple corners can be active at once if you need more than one covered - say, an image with a watermark in one corner and a timestamp in another.
The inputs and outputs that matter
width/height(default 1024, step 8) - canvas size for the generated mask. These need to match the image you're going to apply the mask to.radius(default 100, step 5) - how large the corner blob is, in pixels. Set this to comfortably cover whatever's actually stamped in the corner - too small and you'll leave a sliver of the watermark visible at the edge of the mask.draw_top_left/draw_top_right/draw_bottom_right/draw_bottom_left(BOOLEAN) - which corner(s) get masked. Onlydraw_bottom_rightdefaults to true, which tracks with bottom-right being the most common watermark placement on stock and generated imagery; flip on whichever corners you actually need.size_as(IMAGE, optional) - point this at your actual source image instead of manually typing matchingwidth/heightvalues. Saves you from a mismatch between the mask's canvas size and the image you're about to apply it to.
Output: a single MASK.
How to install it
Via ComfyUI Manager: search "ComfyUI-utils-nodes," install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/zhangp365/ComfyUI-utils-nodes
Restart ComfyUI. No models required - this generates a mask procedurally, so there's nothing to download beyond the node itself.
Common issues & troubleshooting
Get the canvas size wrong and the mask will misalign with your image the moment you composite it - this is the single most common mistake with any procedurally-generated mask, and it's exactly what size_as exists to prevent. Use it instead of hand-typing width/height whenever you have the source image already in the graph.
On the actual inpainting side: this mask only removes what's in the corner region you cover. If the watermark is bigger than your radius, or positioned slightly off from a true corner (some watermarks sit with a margin rather than flush against the edge), you'll get a partial removal - bump radius up, or nudge your expectations toward "this gets you most of the way, check the result" rather than a guaranteed clean removal on every source image. And once you've got the mask, remember it's just the mask - you still need an actual inpaint step (or a generative edit node) downstream to fill in what the mask covers; this node only tells the next step where, not what to do about it.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| width | INT | 10240–8096 | — |
| height | INT | 10240–8096 | — |
| radius | INT | 1000–8096 | — |
| draw_top_left | BOOLEAN | false | — |
| draw_top_right | BOOLEAN | false | — |
| draw_bottom_right | BOOLEAN | true | — |
| draw_bottom_left | BOOLEAN | false | — |
| size_asopt | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |