docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,209 @@
|
||||
---
|
||||
id: wiki-2026-0508-vary-region-인페인팅
|
||||
title: Vary Region (인페인팅)
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Inpainting, Midjourney Vary Region, Region-Based Editing]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [image-generation, inpainting, midjourney, editing, diffusion]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: text
|
||||
framework: Midjourney/FLUX-Fill/SDXL-Inpainting
|
||||
---
|
||||
|
||||
# Vary Region (인페인팅)
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 Vary Region 의 핵심 = 'mask 의 selective regeneration with prompt 의 re-injection'."**. 매 2023 Midjourney 의 introduction 의 since 매 industry standard 의 region-aware editing 의 became. 2026 era 매 FLUX.1 Fill / SDXL Inpainting / Adobe Firefly Generative Fill 의 mainstream — 매 entire image 의 regenerate 의 X 의 specific area 만 의 modify.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 동작 원리
|
||||
- **Mask**: 매 binary image (white = edit, black = preserve) 의 user-drawn or auto-segmented.
|
||||
- **Latent blending**: 매 unmasked region 의 original latent 의 preserve, masked region 만 의 noise → denoise.
|
||||
- **Prompt re-injection**: 매 new prompt 의 masked area 의 conditioning 의 only.
|
||||
- **Boundary blending**: 매 mask edge 의 soft blur 의 seamless transition.
|
||||
|
||||
### 매 Use cases
|
||||
- **Object removal**: unwanted person / watermark / logo 의 remove.
|
||||
- **Object addition**: empty desk 의 coffee cup 의 add.
|
||||
- **Object replacement**: red car → blue car.
|
||||
- **Detail enhancement**: face / hand 의 specific 의 refinement.
|
||||
- **Outpainting**: 매 canvas 의 expand 의 logical extension.
|
||||
|
||||
### 매 Variants
|
||||
1. **Vary Region (Subtle)**: 매 minor change — color / texture.
|
||||
2. **Vary Region (Strong)**: 매 major regeneration — different object.
|
||||
3. **Remix mode**: 매 prompt 의 swap 의 enable.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Pattern 1: Midjourney 의 Vary Region workflow
|
||||
```text
|
||||
1. /imagine prompt: cozy living room, modern minimalist
|
||||
2. Upscale → click "Vary (Region)"
|
||||
3. Draw mask over old TV
|
||||
4. Edit prompt: "large bookshelf with plants"
|
||||
5. Submit → MJ regenerates only masked area
|
||||
```
|
||||
|
||||
### Pattern 2: SDXL inpainting (diffusers)
|
||||
```python
|
||||
from diffusers import StableDiffusionXLInpaintPipeline
|
||||
from PIL import Image
|
||||
import torch
|
||||
|
||||
pipe = StableDiffusionXLInpaintPipeline.from_pretrained(
|
||||
"diffusers/stable-diffusion-xl-1.0-inpainting-0.1",
|
||||
torch_dtype=torch.float16,
|
||||
).to("cuda")
|
||||
|
||||
init_image = Image.open("room.png").convert("RGB")
|
||||
mask_image = Image.open("mask.png").convert("RGB") # white = inpaint
|
||||
|
||||
result = pipe(
|
||||
prompt="large oak bookshelf filled with leather books and potted plants",
|
||||
image=init_image,
|
||||
mask_image=mask_image,
|
||||
strength=0.95,
|
||||
guidance_scale=8.0,
|
||||
num_inference_steps=40,
|
||||
).images[0]
|
||||
|
||||
result.save("inpainted.png")
|
||||
```
|
||||
|
||||
### Pattern 3: FLUX.1 Fill (2026 SOTA)
|
||||
```python
|
||||
import replicate
|
||||
|
||||
output = replicate.run(
|
||||
"black-forest-labs/flux-fill-pro",
|
||||
input={
|
||||
"image": open("room.png", "rb"),
|
||||
"mask": open("mask.png", "rb"),
|
||||
"prompt": "vintage typewriter on wooden desk",
|
||||
"guidance_scale": 30, # FLUX uses higher guidance
|
||||
"num_inference_steps": 50,
|
||||
},
|
||||
)
|
||||
```
|
||||
|
||||
### Pattern 4: Auto-mask via SAM 2 (Segment Anything)
|
||||
```python
|
||||
from segment_anything_2 import SAM2ImagePredictor
|
||||
import numpy as np
|
||||
|
||||
predictor = SAM2ImagePredictor.from_pretrained("facebook/sam2-hiera-large")
|
||||
predictor.set_image(image)
|
||||
|
||||
# Click point on object to remove
|
||||
point_coords = np.array([[450, 300]])
|
||||
point_labels = np.array([1])
|
||||
|
||||
masks, scores, _ = predictor.predict(
|
||||
point_coords=point_coords,
|
||||
point_labels=point_labels,
|
||||
multimask_output=True,
|
||||
)
|
||||
best_mask = masks[scores.argmax()]
|
||||
```
|
||||
|
||||
### Pattern 5: Outpainting (canvas expansion)
|
||||
```python
|
||||
from PIL import Image
|
||||
|
||||
# Expand canvas to right
|
||||
original = Image.open("portrait.png") # 512x512
|
||||
expanded = Image.new("RGB", (1024, 512), (0, 0, 0))
|
||||
expanded.paste(original, (0, 0))
|
||||
|
||||
# Mask: black on left half (preserve), white on right half (generate)
|
||||
mask = Image.new("L", (1024, 512), 0)
|
||||
for x in range(512, 1024):
|
||||
for y in range(512):
|
||||
mask.putpixel((x, y), 255)
|
||||
|
||||
result = pipe(
|
||||
prompt="continuation of mountain landscape, same lighting and style",
|
||||
image=expanded,
|
||||
mask_image=mask,
|
||||
strength=1.0,
|
||||
).images[0]
|
||||
```
|
||||
|
||||
### Pattern 6: ControlNet Inpaint (preserve structure)
|
||||
```python
|
||||
from diffusers import StableDiffusionXLControlNetInpaintPipeline, ControlNetModel
|
||||
|
||||
controlnet = ControlNetModel.from_pretrained("destitech/controlnet-inpaint-dreamer-sdxl")
|
||||
pipe = StableDiffusionXLControlNetInpaintPipeline.from_pretrained(
|
||||
"stabilityai/stable-diffusion-xl-base-1.0",
|
||||
controlnet=controlnet,
|
||||
)
|
||||
|
||||
# Preserves edges / depth while regenerating
|
||||
result = pipe(
|
||||
prompt="red sports car, same angle and lighting",
|
||||
image=original,
|
||||
mask_image=mask,
|
||||
control_image=canny_edge_map,
|
||||
).images[0]
|
||||
```
|
||||
|
||||
### Pattern 7: Adobe Firefly Generative Fill (Photoshop API)
|
||||
```javascript
|
||||
const response = await fetch('https://firefly-api.adobe.io/v3/images/generative-fill', {
|
||||
method: 'POST',
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
body: JSON.stringify({
|
||||
image: { source: { url: imageUrl } },
|
||||
mask: { source: { url: maskUrl } },
|
||||
prompt: 'a vase of fresh tulips',
|
||||
}),
|
||||
});
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Casual / no-code | Midjourney Vary Region |
|
||||
| Photoshop integrated | Adobe Firefly Generative Fill |
|
||||
| API / batch | FLUX.1 Fill Pro (Replicate) |
|
||||
| Local / private | SDXL Inpainting + diffusers |
|
||||
| Auto-mask | SAM 2 + inpainting pipe |
|
||||
| Preserve structure | ControlNet Inpaint variant |
|
||||
|
||||
**기본값**: FLUX.1 Fill Pro (quality) 또는 SDXL Inpainting (local/free).
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Generative-AI]] · [[Diffusion-Models]]
|
||||
- 변형: [[Outpainting]]
|
||||
- Adjacent: [[Image Prompt 작성 방법]] · [[Adobe-Firefly]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: mask region 의 prompt 의 generation / what-to-remove decision / multi-region edit planning.
|
||||
**언제 X**: 매 mask itself 의 drawing — 매 visual / spatial task 의 LLM 의 weak.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Mask too tight**: 매 boundary artifact — 매 8-16px feather 의 add.
|
||||
- **Strength=1.0 with same prompt**: 매 unnecessary regeneration. strength=0.7-0.95 의 prefer.
|
||||
- **Ignoring lighting consistency**: 매 inpainted region 의 lighting 의 mismatch — 매 prompt 의 explicit "same lighting" 의 add.
|
||||
- **No reference to surroundings**: prompt 의 isolated description — 매 context 의 mention ("matching the wooden desk").
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified: Midjourney docs (2026), Black Forest Labs FLUX Fill paper, diffusers documentation.
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — full inpainting / Vary Region guide |
|
||||
Reference in New Issue
Block a user