Nodes/zhangp365/ComfyUI-utils-nodes/Mask Cover Four Corners
ComfyUI Node

Mask Cover Four Corners

Generate a corner mask, built for stripping watermarks

By zhangp365·Created 2 years ago·Updated 5 months ago· 134
Mask Cover Four Corners
  • size_as
  • MASK
width1024
height1024
radius100
draw_top_leftfalse
draw_top_rightfalse
draw_bottom_righttrue
draw_bottom_leftfalse

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. Only draw_bottom_right defaults 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 matching width/height values. 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.

Categoryutils/mask

Inputs (8)

NameTypeDefaultDescription
widthINT10240–8096
heightINT10240–8096
radiusINT1000–8096
draw_top_leftBOOLEANfalse
draw_top_rightBOOLEANfalse
draw_bottom_rightBOOLEANtrue
draw_bottom_leftBOOLEANfalse
size_asoptIMAGE

Outputs (1)

NameTypeDescription
MASKMASK