Files
2nd/10_Wiki/Topics/AI_and_ML/사후 편집 (Post-editing).md
T
2026-05-10 22:08:15 +09:00

210 lines
7.7 KiB
Markdown

---
id: wiki-2026-0508-사후-편집-post-editing
title: 사후 편집 (Post-editing)
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Post-editing, AI Image Post-editing, Image Refinement]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [image-generation, post-editing, midjourney, flux, photoshop, comfyui]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: python
framework: ComfyUI/Photoshop-Generative-Fill
---
# 사후 편집 (Post-editing)
## 매 한 줄
> **"매 generation 은 draft, 매 final 은 post-edit 의 결과"**. 매 2026 production pipeline 에서 raw text-to-image output 의 직접 ship 의 X — 매 inpaint, upscale, color-grade, retouching 의 multi-stage refinement 가 standard. Midjourney/FLUX/Imagen 4 의 base generation + ComfyUI region-edit + Photoshop Generative Fill 의 hybrid workflow 가 매 commercial baseline.
## 매 핵심
### 매 post-editing 의 정의
- 매 generated image 의 결함 의 fix + intent 의 align.
- 매 stage: ① local fix (face/hand/text), ② global polish (color, contrast), ③ composition (crop, insert), ④ upscale (output res).
- 매 zero-edit ship 의 X — 매 99% 의 commercial output 이 적어도 1 단계 의 post-edit 의 거침.
### 매 도구 stack (2026)
- **Midjourney V8 Editor**: 매 inpaint + extend (uncrop) + retexture 의 in-platform.
- **Photoshop 2026 Generative Fill (FLUX-2 backed)**: 매 industry default — layer 호환.
- **ComfyUI + FLUX.1 Fill / SDXL Inpaint**: 매 open-source pipeline. 매 reproducible.
- **Magnific / Krea Upscale**: 매 1024 → 4K 의 detail-add upscaling.
- **Topaz Photo AI**: 매 noise/blur 의 cleanup.
- **Adobe Firefly 4**: 매 commercial-safe (training-data 의 license 명확).
### 매 typical 결함 카테고리
1. **해부학적 오류**: hand (6 fingers), feet, eye 의 asymmetry.
2. **Text 의 garbled**: logo, sign, caption 의 letters 의 corruption.
3. **Composition 의 mismatch**: edge 의 cut, perspective 의 break.
4. **Style drift**: face 의 character 의 inconsistency (multi-shot).
5. **Lighting 의 implausible**: shadow direction 의 conflict.
### 매 응용
1. Marketing / e-commerce visual production.
2. Concept art / pre-viz.
3. Editorial illustration.
4. Game asset (texture, character).
5. Architectural rendering의 humanization.
## 💻 패턴
### Pattern 1 — Inpaint (ComfyUI + FLUX.1 Fill)
```python
# ComfyUI API workflow snippet
import json, requests, base64
from PIL import Image
def inpaint_region(image_path, mask_path, prompt):
workflow = json.load(open("flux_fill.json"))
workflow["3"]["inputs"]["image"] = base64.b64encode(open(image_path, "rb").read()).decode()
workflow["4"]["inputs"]["mask"] = base64.b64encode(open(mask_path, "rb").read()).decode()
workflow["6"]["inputs"]["text"] = prompt
workflow["7"]["inputs"]["steps"] = 28
workflow["7"]["inputs"]["cfg"] = 3.5
r = requests.post("http://127.0.0.1:8188/prompt", json={"prompt": workflow})
return r.json()["prompt_id"]
# Fix 6-finger hand
inpaint_region("draft.png", "hand_mask.png",
"anatomically correct human hand, 5 fingers, natural pose")
```
### Pattern 2 — Hand-fix automated detection
```python
import cv2, mediapipe as mp
mp_hands = mp.solutions.hands.Hands(static_image_mode=True, max_num_hands=4)
def detect_bad_hands(img_path):
img = cv2.imread(img_path)
res = mp_hands.process(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
bad = []
if res.multi_hand_landmarks:
for lm in res.multi_hand_landmarks:
# Heuristic: finger length ratio, joint angles
if not is_anatomically_valid(lm):
bad.append(bbox_from_landmarks(lm, img.shape))
return bad # → mask + inpaint
```
### Pattern 3 — Face consistency (IP-Adapter FaceID)
```python
from diffusers import FluxFillPipeline
import torch
pipe = FluxFillPipeline.from_pretrained(
"black-forest-labs/FLUX.1-Fill-dev",
torch_dtype=torch.bfloat16
).to("cuda")
# Reference face → swap into draft
from ip_adapter import IPAdapterFaceID
adapter = IPAdapterFaceID(pipe, "ip-adapter-faceid-flux.bin")
result = adapter.generate(
image=draft, mask=face_mask,
face_image=reference_face,
prompt="same person, professional headshot",
num_inference_steps=30, guidance_scale=4.0,
)
```
### Pattern 4 — Upscale + detail (Magnific-style)
```python
# SUPIR / FLUX-Upscale style
from diffusers import StableDiffusionUpscalePipeline
upscaler = StableDiffusionUpscalePipeline.from_pretrained(
"stabilityai/stable-diffusion-x4-upscaler", torch_dtype=torch.float16
).to("cuda")
hi_res = upscaler(
prompt="ultra-detailed photograph, sharp focus, 8k",
image=Image.open("draft_1024.png"),
num_inference_steps=20, guidance_scale=7,
).images[0]
hi_res.save("final_4k.png")
```
### Pattern 5 — Color grading (LUT in Pillow)
```python
from PIL import Image
import numpy as np
def apply_lut(img: Image.Image, lut_path: str) -> Image.Image:
lut = np.load(lut_path) # shape (33,33,33,3)
arr = np.asarray(img).astype(np.float32) / 255.0
idx = (arr * 32).astype(np.int32)
out = lut[idx[..., 0], idx[..., 1], idx[..., 2]]
return Image.fromarray((out * 255).astype(np.uint8))
# Apply teal-orange cinematic LUT
final = apply_lut(Image.open("graded_input.png"), "teal_orange.npy")
```
### Pattern 6 — Photoshop scripting (Generative Fill)
```javascript
// Photoshop 2026 .jsx — Generative Fill via ExtendScript
var doc = app.activeDocument;
doc.selection.select([[120,80],[420,80],[420,380],[120,380]]);
var generativeFill = stringIDToTypeID("generativeFill");
var desc = new ActionDescriptor();
desc.putString(stringIDToTypeID("prompt"), "remove power lines, clean sky");
executeAction(generativeFill, desc, DialogModes.NO);
doc.saveAs(new File("/out/cleaned.psd"));
```
### Pattern 7 — Batch QA loop
```python
def post_edit_pipeline(draft_path):
img = load(draft_path)
if has_bad_hands(img):
img = inpaint_hands(img)
if has_garbled_text(img):
img = inpaint_text(img, target_text="ACME Corp")
img = color_grade(img, lut="film_emulation.npy")
img = upscale_4x(img)
return img
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| 빠른 fix, 1장 | Photoshop Generative Fill |
| Reproducible, batch | ComfyUI workflow JSON |
| Face/character lock | IP-Adapter FaceID + inpaint |
| Detail-add upscale | Magnific / SUPIR |
| Commercial license worry | Adobe Firefly 4 |
**기본값**: 매 ComfyUI + FLUX.1 Fill 의 reproducible base, 매 final touch 만 Photoshop.
## 🔗 Graph
- 부모: [[AI 이미지 생성 (AI Image Generation)]] · [[AI 이미지 생성 및 편집 워크플로우 (AI Image Generation & Editing Workflow)]]
- 변형: [[Inpainting]] · [[Outpainting]] · [[Upscaling]]
- 응용: [[상업용 브랜드 이미지 및 디자인 시스템 구축]] · [[Concept Art Workflow]]
- Adjacent: [[ControlNet]] · [[IP-Adapter]] · [[Magnific Upscale]]
## 🤖 LLM 활용
**언제**: 매 prompt 의 generation, 매 mask 의 description, 매 QA 의 결함 카테고리화.
**언제 X**: 매 final pixel-level decision (designer 의 eye 가 필요).
## ❌ 안티패턴
- **Re-roll forever**: 매 100 generations 의 spam 보다 매 1 inpaint 가 빠름.
- **Single-pass ship**: 매 raw text-to-image 의 commercial use 의 X.
- **Mask 의 too-tight**: 매 boundary artifact. 매 feather 8-16px 의 default.
- **Upscale before fix**: 매 결함 의 amplification. 매 fix → upscale 의 순서.
## 🧪 검증 / 중복
- Verified (FLUX.1 Fill release notes 2025-11; Adobe Firefly 4 docs; ComfyUI manager wiki).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — multi-stage post-edit pipeline + 7 patterns |