Nodes/NovelAI GENYTOOLS/NAI 局部重绘采样器
ComfyUI Node

NAI 局部重绘采样器

Fix just the broken part — masked inpainting that ships a proper NovelAI infill request

By XTOGENY·Created 3 months ago·Updated about a month ago· 20
NAI 局部重绘采样器
  • image
  • mask
  • nai_pipe
  • positive
  • negative
  • core_settings
  • advanced_settings
  • 图像批次
  • 实际Seed列表
  • 费用与统计
◄seed0►
◄image_count1►
◄max_anlas0►
◄strength1.00►
◄noise0.00►
◄add_original_imagetrue►
◄mask_expand0►
◄mask_feather20►
◄edge_protectiontrue►

Inpainting is the "fix what's wrong, leave everything else alone" technique, and NAI 局部重绘采样器 (Inpaint Sampler) is how you do it against NovelAI's API. You give it an IMAGE plus a MASK - white where you want things re-rendered - and it sends a proper NovelAI infill request, then composites the regenerated region back onto the original so the unmasked pixels come back bit-identical. That last part is the whole value proposition of masked inpainting versus a whole-image edit: nothing outside the mask moved.

It's a superset of the img2img sampler: all the same pipe, prompts, cards, seed, image_count (1–4), max_anlas, strength and noise inputs, plus the mask plumbing on top.

The inputs NovelAI-specific people will recognize

  • strength - default 1.0 here (img2img defaults lower). This is the denoise dial for the masked area: 1.0 is full regeneration within the mask, 0.3–0.6 is gentle tweaking. Same rule as every inpainting guide: match strength to the job, not the default.
  • add_original_image - default on. Whether the original pixels are sent along as context so the model knows what's outside the mask. Leave it on; this is what keeps the regenerated region consistent with the rest of the scene.
  • mask_expand - 0–128px. Grows the mask before the request goes out. Useful when your mask is a hair too tight and the model's content bleeds at the edge.
  • mask_feather - default 20px. Softens the mask edge for the composite-back step. This is the seam killer; too low and you get a hard cut line.
  • edge_protection - default on. Uses the feathered, official-style composite back to the original. Turn it off and you get a hard-edged paste.

Under the hood it does the official NovelAI inpaint dance: the request uses the model's native inpainting structure (with the latent-space padding NovelAI expects), and the re-blend back onto the original is done the way NovelAI's own site does it rather than a naive paste.

The model note

V5 Full uses native V5 inpainting. V5 Curated currently falls back to V4.5 Curated inpainting to match the website's behavior - which means V5 Curated inpainting runs are capped at 6 character regions even though V5 Full text-to-image allows 32. If your character regions won't go past six in an inpaint, that's the reason.

Install and where it fits

Search ComfyUI-NovelAI-GENYTOOLS in ComfyUI Manager or git clone https://github.com/XTOGENY/ComfyUI-NovelAI-GENYTOOLS.git into custom_nodes, pip install -r requirements.txt, token in settings.

Practical notes from the inpainting playbook, adapted to paid calls: for fixing small detail (a face, a hand), keep the mask tight but feather it, and consider bumping strength per the change you want - a 0.4 inpainting pass fixes an artifact, a 0.9 pass replaces the subject. And check your mask before you spend: an accidentally empty mask returns the image unchanged while quietly charging you, which is the one failure mode this node can't defend against. Preview the mask, then run.

CategoryNovelAI 2.0/生成

Inputs (16)

NameTypeDefaultDescription
imageIMAGE—
maskMASK—
nai_pipeNAI_PIPE—
positiveNAI_POSITIVE_PROMPT—
negativeNAI_NEGATIVE_PROMPT—
core_settingsNAI_CORE_SETTINGS—
advanced_settingsNAI_ADVANCED_SETTINGS—
seedINT00–4294967295—
image_countINT11–4—
max_anlasFLOAT00–100000—
strengthFLOAT1.000.01–1—
noiseFLOAT0.000–1—
add_original_imageBOOLEANtrue—
mask_expandINT00–128—
mask_featherINT200–64—
edge_protectionBOOLEANtrue—

Outputs (3)

NameTypeDescription
图像批次IMAGE—
实际Seed列表STRING—
费用与统计STRING—