Nodes/ComfyUI Inpaint Region Editor/Inpaint Region Editor
ComfyUI Node

Inpaint Region Editor

The inpainting node that finally lets you drag the context box and edit masks like it's Photoshop

By abc-lee·Created 6 months ago·Updated about a month ago· 1
Inpaint Region Editor
    • image
    • mask
    • region_top
    • region_left
    • region_width
    • region_height
    image
    padding64

    If you've inpainted in ComfyUI for more than an afternoon, you know the pain. The model is usually fine. The mask is the problem - drawing anything more complex than a blob in the built-in editor is a chore, and the reference region ComfyUI expands around your mask is a dumb fixed-shape box. This node goes after both of those at once, and it does it without leaving your browser.

    Inpaint Region Editor is a mask/region editor that ships a real image editor inside ComfyUI. Two things happen when you drop in a PNG with an alpha channel: the alpha becomes your mask (transparent areas = the region to repaint, per ComfyUI's 1-equals-masked convention), and an orange box appears around the mask's bounding box. That box is your reference region - the slice of original pixels the model gets to look at while it regenerates the masked area. You can grab it, drag it, and resize it by the edges, and the node hands you the resulting coordinates so the rest of your graph knows exactly where that box sits.

    Why does that matter? The native behavior expands the reference region uniformly from the mask edge. When your mask butts against the image boundary, that expansion runs off the canvas, and the model is trying to reference pixels that don't exist. Being able to shove the box somewhere sensible by hand - "look at the whole face, not just this cheek" - fixes a lot of bad inpaints before they happen.

    The Photopea part is the headline

    Right-click the node and you get two options: Edit Image (Photopea) and Edit Mask (Photopea). That opens a Photopea instance in an iframe - the free, in-browser Photoshop workalike. Edit image mode gives you liquefy, clone stamp, healing brush, color adjustments, the works, and the result gets saved straight back to the node. Edit mask mode is the interesting one: a dual-layer setup with your image as reference and a mask layer on top, so you can paint complex shapes and - this is the part people don't expect - feather by hand. Paint semi-transparent gray with a soft brush and you get alpha values between 1 and 254, i.e. a gradual transition, instead of the algorithmic blur you'd normally bolt on after the fact.

    It's clever, but it has a real cost: Photopea loads from a CDN, roughly 10MB on first use, and it needs a network connection. No internet, no editor. Keep images at or under 2048×2048, or Photopea gets sluggish.

    The inputs and outputs that matter

    The node's interface is refreshingly small. Two inputs:

    • image - pick from your ComfyUI input directory, upload, or Ctrl+V paste. PNGs with alpha are the happy path; without alpha the node just outputs an empty mask and treats the whole image as the region.
    • padding - INT, default 64, range 0–512. The pixels of reference context added around the mask bounding box when computing the initial region. Crank it up if the model keeps losing context; the step is 32.

    And six outputs: image (RGB, alpha stripped), mask, and four INTS - region_top, region_left, region_width, region_height. Those four are the real payload. Wire them into an ImageCrop (and the mask into a CropMask), scale the crop up to your model's native resolution, sample, scale back down, and composite with ImageCompositeMasked. That's the "only masked at full resolution" pattern - a 64px detail gets 1024px of generation budget - and the included workflow.json lays it out end to end.

    Installing it

    ComfyUI Manager, search "Inpaint Region Editor", install, restart. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/abc-lee/ComfyUI-InpaintRegionEditor.git
    

    Then restart ComfyUI. No Python deps to worry about - the pyproject declares an empty dependency list. The node's needs are all front-end: the Photopea CDN and your browser.

    The honest caveats

    This is a young node (v1.6, March 2026) with zero community track record, so treat it as a promising tool rather than a battle-tested one. Two failure modes stand out from the source: if you shrink the region below the mask, the node throws a Region too small! Must be >= mask error rather than silently producing garbage - that's a feature. And remember the region always clamps to image bounds, so a mask at the very edge means the box hugs the border no matter how you drag it.

    The other thing to know: this node doesn't care what model does the inpainting - it's a mask-and-context producer, so it pairs as well with a plain SetLatentNoiseMask pass as with InpaintModelConditioning or Flux Fill on the crop-and-stitch path. If masking is where your inpaints go to die - and for a lot of people it is - this is the most direct fix ComfyUI has on offer.

    Categoryimage/inpaint

    Inputs (2)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png
    paddingINT640–512

    Outputs (6)

    NameTypeDescription
    imageIMAGE
    maskMASK
    region_topINT
    region_leftINT
    region_widthINT
    region_heightINT