smart_image_gen v0.7.6: feather inpaint mask edges via GrowMask
The raw SAM mask is a hard binary edge — KSampler repaints right up
to it, and SDXL has no surrounding-pixel context inside the mask to
blend with. Result: the inpainted region looks pasted-on with visible
seams (the artifact the user reported on the werewolf-groin edit).
Inserted a stock GrowMask node (id 17) between
GroundingDinoSAMSegment and SetLatentNoiseMask:
- expand=12 grows the mask outward by 12 px so the new content
overlaps a strip of original pixels for blending
- tapered_corners=True softens the edge so the noise transition
isn't a step function
GrowMask is built into stock ComfyUI; no extra custom node install.
KSampler still uses the caller-supplied denoise (default 1.0 in
inpaint mode).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
1ed2e7293e
commit
63917709c1
1 file changed
+15
-2
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
title: Smart Image Generator & Editor (ComfyUI)
|
||||
author: ai-stack
|
||||
version: 0.7.5
|
||||
version: 0.7.6
|
||||
description: Generate or edit images via ComfyUI with automatic SDXL
|
||||
checkpoint routing. Two methods — generate_image (txt2img) and
|
||||
edit_image (img2img on the user's most recently attached image). The
|
||||
@@ -303,6 +303,13 @@ def _build_inpaint(positive: str, negative: str, settings: dict,
|
||||
"the dog's collar"), then SetLatentNoiseMask + KSampler repaint
|
||||
only that region. Everything outside the mask stays pixel-perfect.
|
||||
|
||||
The raw SAM mask is run through GrowMask with tapered_corners
|
||||
before it reaches the sampler. Without that, the mask edge is
|
||||
pixel-binary and KSampler repaints right up to a hard boundary —
|
||||
SDXL has no surrounding-pixel context inside the mask to blend
|
||||
with, so the inpainted region looks pasted-on with visible seams.
|
||||
expand=12px + taper gives a soft transition that blends naturally.
|
||||
|
||||
First inpaint downloads ~3 GB of SAM/GroundingDINO weights into
|
||||
/opt/comfyui/models/{sams,grounding-dino}/ — subsequent runs reuse
|
||||
them.
|
||||
@@ -329,7 +336,7 @@ def _build_inpaint(positive: str, negative: str, settings: dict,
|
||||
"11": {"class_type": "VAEEncode", "inputs": {"pixels": ["12", 0], "vae": ["4", 2]}},
|
||||
"12": {"class_type": "LoadImage", "inputs": {"image": image_filename}},
|
||||
"13": {"class_type": "SetLatentNoiseMask",
|
||||
"inputs": {"samples": ["11", 0], "mask": ["16", 1]}},
|
||||
"inputs": {"samples": ["11", 0], "mask": ["17", 0]}},
|
||||
"14": {"class_type": "SAMModelLoader (segment anything)",
|
||||
"inputs": {"model_name": "sam_hq_vit_h (2.57GB)"}},
|
||||
"15": {"class_type": "GroundingDinoModelLoader (segment anything)",
|
||||
@@ -342,6 +349,12 @@ def _build_inpaint(positive: str, negative: str, settings: dict,
|
||||
"prompt": mask_text,
|
||||
"threshold": 0.3,
|
||||
}},
|
||||
"17": {"class_type": "GrowMask",
|
||||
"inputs": {
|
||||
"mask": ["16", 1],
|
||||
"expand": 12,
|
||||
"tapered_corners": True,
|
||||
}},
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user