対象: R18同人「8番出口型 異変探し×エロ」CG集の制作者(Windows / ComfyUI portable / SDXL・Illustrious・Pony・Flux / ローカルGPU) 狙い: 「1枚のベース画像をマスターとし、その一部だけをAIで追加/削除/置換」して、廊下・タイル・ライト・小物の位置を完全一致させたまま"異変(差分)"を入れる。間違い探しが成立する唯一の作り方。 作成: 2026-06-13 / 検証方針: 一次未確認の数値・ライセンス可否・ノード挙動は本文中に (要確認) と明示。捏造はしない。
[Load Image] ベース画像(正常版・1枚に確定させる)
│
├──────────────► (異変対象を指定してマスク化)
│ A: GroundingDinoSAMSegment("sign"/"vase"/"poster"…)
│ B: Impact SEGS Detector → MASK to SEGS
│ C: MaskEditor 手描き
│ │ MASK
│ ▼
│ [Expand Mask] +4〜8px ─► [Gaussian Blur Mask] σ=1〜3 ← 継ぎ目を溶かす前処理
│ │ (グラデMASK)
▼ ▼
[Inpaint Crop] ◄── image+mask ─────────────────────────────┐ ← マスク周辺だけ切出し・背景温存
│ cropped_image, cropped_mask │
▼ │
[InpaintModelConditioning] (vae, pixels, mask, pos, neg) │
│ positive/negative/latent │
▼ │
[Load Checkpoint] ─► [DifferentialDiffusion] ─► model ─► [KSampler] (denoise 0.6〜0.9)
│ LATENT
[ControlNet: Tile/Lineart/Depth(元画像から条件抽出)] ─────┘ ← 背景の輪郭・遠近を拘束
│ ▼
│ [VAE Decode]
│ │ IMAGE
└──────────────────────────────────────────► [Inpaint Stitch] ◄── 元画像へ完全合成・マスク外は不変
│
▼
[Color Match (Masked)] ← 色/明度ズレ補正
▼
[Save Image] 異変版(完成)
ポイント: KSamplerは「Crop で切り出した小領域」だけを処理する。全画面をVAE encode/decodeしないので、(1)背景が1bitも変わらない (2)高速 (3)継ぎ目はBlur+Color Matchで消える。文字・数字は AIに描かせず、最後にPILで合成するのが文字化け再発を防ぐ定石(要確認だが実務の鉄則)。
1枚のベース画像をマスターとし、Inpaint Crop and Stitchでマスク外を完全凍結しながら差分を入れる方式が最も背景同一性を保てる。Differential DiffusionまたはInpaintModelConditioningを併用すると継ぎ目が安定しやすい。Crop&Stitch経由が最も推奨。
Load Image → GroundingDinoSAMSegmentまたはImpact SEGM Detector → Inpaint Crop → VAEEncodeForInpaint/InpaintModelConditioning → KSampler(DifferentialDiffusion適用可) → VAEDecode → Inpaint Stitch
Load Image ──► Mask生成(自動/手動) ──► Inpaint Crop
│
▼
VAEEncode + Conditioning
│
▼
KSampler(+DifferentialDiffusion)
│
▼
VAEDecode ──► Inpaint Stitch ──► 完成画像
A: GroundingDinoModelLoader → SAMModelLoader → GroundingDinoSAMSegment
入力:IMAGE、テキスト("sign","poster","vase"など)
出力:IMAGE、MASK
threshold(0.0-1.0)で検出感度調整。文字や小物指定に強い。
B: UltralyticsDetectorProviderまたはBBOX Detector(combined) → SAMDetector(combined)またはMASK to SEGS
出力:SEGS → Detailer(SEGS)で局所処理後、SEGSPasteで合成。検出器依存で物体単位のマスク向き。
C: 手描きマスクはLoad Image(マスク用)またはMaskEditor相当(要確認)で作成。色選択はToBinaryMaskで二値化。
Load Image → InpaintModelConditioning(positive/negative/vae/pixels/mask)
出力latentをKSamplerへ。noise_maskトグルはUIバージョンにより異なる(要確認)。
Load Checkpoint → DifferentialDiffusion → KSampler(model入力)
マスクはGaussian BlurでぼかしてからInpaintModelConditioningまたはVAEEncodeForInpaintへ渡す。
Image+Mask → Inpaint Crop → VAEEncode → KSampler → VAEDecode → Inpaint Stitch
mask_blend_pixelsとcontext_from_mask_extend_factorで継ぎ目を調整(要確認)。
Load Fooocus Inpaint → "VAE Encode & Inpaint Conditioning"
latent_inpaintとlatent_samplesの2系統を出力し、Apply Fooocus InpaintとKSamplerへ分岐。
A: Load Inpaint Model(LaMa/MAT) → "Inpaint (using Model)"(プロンプト不要)
B: Inpaint Crop&Stitch + 追加プロンプトで物体生成
C: GroundingDinoSAMSegment("sign")でマスク → InpaintModelConditioningで数字再生成
D: Differential Diffusion(ぼかしたマスク) + ControlNet(Tile/Depth)で姿勢変更
元画像 → プリプロセッサ(Tile/Lineart/Canny/Depth) → ControlNet Apply
Apply出力をKSamplerに接続。Segment制御も併用可。xinsir controlnet-union-sdxl-1.0使用(Apache 2.0)。
ノードIDは0から連番。linksは[出力元ID,出力スロット,入力先ID,入力スロット,型]の配列で記述。
最小骨子はLoad Image(1)→Mask生成(2)→Inpaint Crop(3)→KSampler(4)→Inpaint Stitch(5)のlinksを明記。
API保存時はextra_pnginfoを削除し、node connectionsのみ残すと再利用性が高い。
inpaint専用版が無い場合はFooocusパッチまたはDifferential Diffusionを代替。score_9, score_8_up等のタグはconditioningに追加。NSFW領域の継ぎ目はColor Match (Masked)で補正後、モザイク処理は最終段に配置。
GroundingDinoModelLoader ──► model
SAMModelLoader ──► sam_model
GroundingDinoSAMSegment(image=Load Image, text_prompt="sign|poster|number|vase", threshold=0.3(要確認), sam_model, grounding_dino_model) ──► mask
Expand Mask(mask, expand=4-8px(要確認)) ──► Gaussian Blur Mask(sigma=1-3(要確認))
出力MASKをInpaint Cropへ。テキスト指定の看板・小物変更に最適。
UltralyticsDetectorProvider(model_name="bbox/handy.pt"(要確認)) ──► BBOX_DETECTOR / SEGM_DETECTOR
BBOX Detector(combined) or SEGM Detector(combined)(image, detector) ──► SEGS
SAMDetector(combined)(SEGS) ──► SEGS
MASK to SEGS(mask) ──► SEGS
SEGS Filter(label="person", size_range) ──► Detailer(SEGS) ──► SEGSPaste
物体検出が安定する人物・大型オブジェクトの置換に最適。
Load Image ──► MaskEditor(右クリック→Open in MaskEditor(要確認)) ──► mask
ToBinaryMask(mask, threshold=128(要確認)) ──► 二値MASK
精密な服変更・ポーズ調整に最適。自動検出が難しい領域で使用。
Load Checkpoint ──► model
CLIPTextEncode(pos/neg) ──► conditioning
InpaintModelConditioning(vae=VAE, pixels=ベース画像, mask) ──► positive/negative/latent
KSampler(model, positive, negative, latent_image, denoise=0.65-0.80(要確認), cfg=5-7(要確認), sampler_name=euler_a or dpmpp_2m(要確認), steps=20-30) ──► VAEDecode
Gaussian Blur Mask(kernel_size=ブラシ径, sigma=2-4(要確認)) ──► グラデーションMASK
DifferentialDiffusion(model) ──► model
KSampler(model, denoise=0.75-0.95(要確認))
境界溶けが強く、継ぎ目が最も安定。
Inpaint Crop(mask, mask_blend_pixels=8(要確認), context_from_mask_extend_factor=1.2(要確認), output_resize_to_target_size=512-768(要確認)) ──► cropped_image
VAEEncode ──► KSampler ──► VAEDecode ──► Inpaint Stitch(original=ベース画像)
マスク外画素を一切触らないため背景同一性最高。
Load Fooocus Inpaint ──► Apply Fooocus Inpaint(model)
"VAE Encode & Inpaint Conditioning"(pixels, mask) ──► latent_inpaint
Apply Fooocus Inpaint(latent_inpaint) ──► latent_samples
KSampler(latent_samples, denoise=0.5-1.0)
GroundingDinoSAMSegment("対象") ──► Expand Mask ──► Load Inpaint Model(LaMa big-lama.pt(要確認)) ──► "Inpaint (using Model)"(プロンプト不要) ──► Color Match(Masked)
物体除去に最適。
手描きマスク or テキストマスク ──► Inpaint Crop ──► InpaintModelConditioning(pos="赤い消火器", denoise=1.0) ──► KSampler ──► Inpaint Stitch ──► Color Match
ControlNet Depth(ベース画像)併用で床・壁の整合。
GroundingDinoSAMSegment("number|sign")で領域限定 ──► Inpaint Crop ──► InpaintModelConditioning(denoise=0.7) ──► KSampler
→ PIL ImageCompositeで数字レイヤー後乗せ(要確認)
AI単独は文字化け再発しやすい。
Differential Diffusion(model) + ControlNet(OpenPose/Lineart) ──► KSampler(denoise=0.65-0.85)
骨格固定しつつ服のみ変更。
Load Image ──► AIO Aux Preprocessor(preprocessor=Tile/Lineart/Depth) ──► controlnet_image
Load ControlNet(model=xinsir controlnet-union-sdxl-1.0(要確認)) ──► Apply ControlNet(strength=0.45-0.65(要確認), end_percent=0.6(要確認)) ──► KSampler.positive
強すぎると異変が入らず、弱すぎると背景がズレるトレードオフ。
{
"nodes": [
{"id":1,"type":"LoadImage","widgets_values":["base.png"]},
{"id":2,"type":"GroundingDinoSAMSegment","inputs":{"image":["1",0],"text_prompt":"sign"}},
{"id":3,"type":"InpaintModelConditioning"},
{"id":4,"type":"KSampler"},
{"id":5,"type":"VAEDecode"},
{"id":6,"type":"SaveImage"}
],
"links": [[1,1,0,2,0,"IMAGE"],[2,2,1,3,2,"MASK"],...]
}
Save(API Format)でprompt形式に変換すると量産向き(要確認)。
DR_Inpaint高度テクニック_2026-06-08.html — Inpaint全般のノード設計・SAM2・denoiseテーブル(本DRと相補。あちらは"修正"、本DRは"異変ペア生成")DR_inpaint局部接触修正手順2026_2026-06-01.html — 局部/接触部の修正極意DR_局所リジェネ_inpaintで顔手局部瞳2026_2026-06-04.html — 顔/手/瞳の局所超解像リジェネDR_breakthrough2_15_inpaint_partial_fix_2026-06-04.html — 部位別Inpaintで局所爆上げDR_8番出口系ループ探索ゲーム派生系譜とヒット要因_2026-06-12.html / DR_8番出口派生市場トレンドと差別化_2026-06-12.html — ジャンル市場・差別化DR_ComfyUI_i2i連鎖_ControlNet複合_キャラ一貫性アングル変更_2026-06-09.html — ControlNet複合の一貫性維持DR_ADetailer顔手自動修正完全ガイド_2026-06-08.html — 顔・手の自動修正(SEGS/Detailer系)_inpaint_dr_draft_gen_2026-06-13.py — 同日作成の「9技術比較」アングル下書き(本DRは"実装結線"アングルで非重複)検証メモ: 上記は2026-06-13時点で実在を確認したURL。ノード名・入出力スロット・grow_mask_by既定6・SDXL inpaint 9ch・Flux非商用・xinsir Apache2.0 は一次/準一次で確認済。denoise/cfg/strength/thresholdの具体数値、MaskEditor手順、Ultralyticsモデルファイル名、PIL後乗せの最適手順は環境差があり「(要確認)」。FLUX.1[dev]のR18商用販売可否はライセンス上の重大リスク=必ず原文と法務で確認すること。