Nodes/was-node-suite-comfyui/Mask Rect Area (Advanced)
ComfyUI Node Runs on cloud

Mask Rect Area (Advanced)

A rectangular mask defined in exact pixels

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
Mask Rect Area (Advanced)

      WAS's plain Mask Rect Area places a rectangle by percentage of the canvas - clever because it scales automatically to whatever resolution you're working at, but useless the moment you need to land a mask at an exact, known pixel location. Mask Rect Area (Advanced) is that other case. Per the README, it creates "a rectangular mask defined by pixels and image size" - you specify the rectangle in absolute pixel coordinates, tell it the canvas size to paint against, and it gives you a mask that lands exactly where you told it to, no percentage math involved.

      Why exact pixels beats percentages here

      Percentages are great when you're eyeballing "roughly the top-left quarter." They're the wrong tool the moment a rectangle's position comes from somewhere numeric - a bounding box returned by a detector node, coordinates you measured off a reference image, a fixed compositing slot you use over and over at a specific resolution. Converting those numbers into fractions of the canvas before feeding Mask Rect Area is an extra, error-prone step. The Advanced variant skips that entirely: feed it the pixel numbers you already have.

      How it works

      You define the rectangle's position and size in absolute pixels, and separately specify the image size the mask canvas should match. The node paints a white rectangle at those exact pixel coordinates on a black canvas sized to match, which is what a mask fundamentally is in ComfyUI - white means "act here," black means "leave alone." Because the canvas size is a separate, explicit input rather than something inferred, the resulting mask always matches your actual working resolution, provided you keep that value in sync with your real image.

      The inputs and outputs that matter

      The rectangle's position and dimensions in pixels, plus the image size to build the mask canvas against. The output is a MASK at that canvas size, with a white rectangle exactly where you specified. It wires into an inpainting sampler, a Set Latent Noise Mask, or anywhere else a MASK is expected - same as its percentage-based sibling, just with pixel-exact placement instead of a proportional one.

      Installing it

      ComfyUI Manager: search "WAS Node Suite," install, restart. Manually:

      cd ComfyUI/custom_nodes
      git clone https://github.com/WASasquatch/was-node-suite-comfyui
      

      install requirements.txt against your ComfyUI Python, restart. Pure geometry, no model or heavy dependency.

      Common issues & troubleshooting

      Mask doesn't line up with the image. Check that the image size input actually matches your real working resolution - if it's stale or hardcoded from an earlier version of your graph, the rectangle's pixel coordinates will be correct relative to the wrong canvas, and the mask will visibly drift off-target once composited against the real image.

      Hard-edged seam after inpainting. Same as any rectangle mask: a razor-sharp rectangle border generates a visible line where the edit meets the original. Modidex's inpainting notes put typical mask feathering around 4–12 pixels, with too little producing hard seams and too much bleeding past the intended edit - run the output through Mask Gaussian Region before using it if you're compositing rather than just previewing.

      Which variant do I actually want? If you're placing a rectangle from a detector's bounding box, known fixed coordinates, or anything already expressed in pixels - this one. If you're eyeballing a rough proportional region that should scale with resolution, the plain Mask Rect Area is less fiddly.

      Whole pack won't import. WAS Node Suite has been unmaintained since the author marked it retired in December 2023; the recurring failure is the entire suite throwing "Import Failed" after a ComfyUI update from a pinned dependency clash. Reinstall requirements.txt against the correct, embedded Python interpreter and restart.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs