--- id: wiki-2026-0508-ai-모델-사후-편집-도구-post-editing-tool title: AI Post-editing Tools (사후 편집) category: 10_Wiki/Topics status: verified canonical_id: self aliases: [AI 모델 사후 편집, post-editing, inpainting, outpainting, vary region, upscale, remix] duplicate_of: none source_trust_level: B confidence_score: 0.85 verification_status: conceptual tags: [image-generation, post-editing, inpainting, outpainting, upscale, midjourney, stable-diffusion, comfyui] raw_sources: [] last_reinforced: 2026-05-09 github_commit: pending inferred_by: Claude Opus 4.7 (manual cleanup 2026-05-09) tech_stack: language: Python / API framework: Diffusers / ComfyUI / Automatic1111 / Photoshop AI --- # AI Post-editing Tools (사후 편집) ## 📌 한 줄 통찰 (The Karpathy Summary) > **매 첫 generation 의 limit → iterative refinement**. **Inpainting (specific region), Outpainting (extend canvas), Remix (variation), Upscale (resolution + detail)**. 매 image 의 raw → polished. 매 base + post-editing > single perfect prompt. ## 📖 구조화된 지식 (Synthesized Content) ### 매 5 core tool #### 1. Inpainting (Vary Region) - 매 specific region 의 mask + new prompt → regenerate. - 매 surrounding 의 preserve. - 매 small fix (extra finger, watermark, background change). **매 platform**: - **Midjourney**: Vary (Region). - **Stable Diffusion**: native inpainting model. - **DALL-E**: native edit. - **Photoshop Generative Fill** (Adobe Firefly). #### 2. Outpainting (Zoom Out / Pan) - 매 canvas 의 extend. - 매 surrounding 의 generate. - 매 logical scene continuation. **매 mode**: - **Zoom Out**: 매 4 side 의 expand (1.5x, 2x). - **Pan**: 매 specific direction. - **Custom**: arbitrary aspect ratio. #### 3. Remix Mode - 매 image 의 variation. - 매 prompt / parameter 의 modify. - 매 region selection 와 combine. #### 4. Upscale - 매 resolution ↑ (e.g. 1024 → 4096). - **Subtle Upscale**: simple resize (less detail). - **Creative Upscale**: AI 의 매 detail / texture 추가. - **ESRGAN / Real-ESRGAN**: open-source. #### 5. Img2Img (Image-to-Image) - 매 input image 의 prompt 에 영향. - **Strength**: 0 (keep) - 1 (total change). - 매 style transfer. ### Iterative refinement workflow #### Stage 1: Generate base - 매 prompt 의 initial generation. - 매 batch (4-8 variant). - 매 select best. #### Stage 2: Identify defect - 매 specific issue: extra finger, weird face, blur, ... - 매 priority. #### Stage 3: Inpaint each - 매 mask + targeted prompt. - 매 incremental fix. #### Stage 4: Outpaint if needed - 매 composition 의 extend. - 매 narrative element 추가. #### Stage 5: Upscale - 매 final resolution. - 매 detail enhancement. → 매 round 의 quality ↑. ### 매 platform 의 specific #### Midjourney V7 - Vary (Region): mask + new prompt. - Vary (Strong / Subtle): variation. - Zoom Out (1.5x, 2x, custom). - Pan (4 direction). - Upscale (Subtle / Creative). - Remix mode (Settings). #### Stable Diffusion (ComfyUI / A1111) - Inpainting (dedicated model: SD 1.5 inpaint, SDXL inpaint, Flux Fill). - Outpainting (custom). - Img2img (built-in). - Upscale: Real-ESRGAN, 4x-UltraSharp, Latent. - ControlNet (precise control). #### DALL-E 3 - Edit (mask-based). - Native chat-based UI. - Limited compared to SD / Midjourney. #### Adobe Firefly / Photoshop - Generative Fill (inpainting). - Generative Expand (outpainting). - 매 layer-based workflow. - 매 commercial license-safe. #### Flux (modern) - Flux.1 Fill (inpaint / outpaint dedicated). - 매 SDXL 보다 좋은 quality. ### 매 technical detail #### Mask quality - 매 selection 의 surrounding context 도 include. - 매 too tight = unnatural seam. - 매 feathering (blur edge) = smoother blend. #### Prompt for masked region - 매 region 의 own prompt. - 매 surrounding context 의 implicit (model 이 see). - 매 style / lighting 의 match. #### Strength / denoising - Lower = preserve more. - Higher = more freedom. - Inpaint: 0.7-0.9 (strong change). - Img2img: 0.3-0.6 (subtle). #### CFG (guidance scale) - 매 prompt adherence. - 매 inpaint 의 7-12 typical. ### Common defect 의 specific fix | Defect | Inpaint approach | |---|---| | Extra fingers | Mask hand + "perfect five-finger hand" | | Asymmetric eyes | Mask both eyes + "symmetric eyes" | | Watermark | Mask + "clean background" | | Wrong color object | Mask + "red shirt" (specific color) | | Background distraction | Mask background + "soft blur, depth of field" | | Too dark / light | Mask + "balanced lighting" | | Missing object | Mask area + "add cat sitting" | | Style mismatch | Mask region + "oil painting style" | ### 매 advanced technique #### Iterative inpaint chain 1. 매 inpaint round. 2. 매 next defect. 3. 매 다음 round. → 매 round 의 small change. #### Multi-region edit - 매 multiple mask 의 sequential. - 매 prompt 의 region-specific. #### Pose / composition fix - ControlNet OpenPose 의 reference. - 매 inpaint 의 pose-guided. #### Style transfer (img2img) - 매 photo → painting. - 매 style 의 reference image (IP-Adapter). #### Face restoration - GFPGAN, CodeFormer. - 매 face-specific model. #### Detail upscale (Tile / Refine) - 매 image 의 tile. - 매 tile 의 separate enhance. - 매 stitch. → 4K / 8K 의 quality ↑. ## 💻 코드 패턴 (Code Patterns) ### Inpainting (Diffusers SDXL) ```python from diffusers import StableDiffusionXLInpaintPipeline import torch from PIL import Image pipe = StableDiffusionXLInpaintPipeline.from_pretrained( "diffusers/stable-diffusion-xl-1.0-inpainting-0.1", torch_dtype=torch.float16, ).to("cuda") original = Image.open("photo.png") mask = Image.open("mask.png") # white = redo, black = keep result = pipe( prompt="clean wooden table, professional product shot", image=original, mask_image=mask, num_inference_steps=30, guidance_scale=7.5, strength=0.85, ).images[0] result.save("inpainted.png") ``` ### Mask generation (programmatic) ```python from PIL import Image, ImageDraw def create_mask(image_size: tuple, region: tuple) -> Image.Image: """region = (x1, y1, x2, y2)""" mask = Image.new('RGB', image_size, 'black') draw = ImageDraw.Draw(mask) draw.rectangle(region, fill='white') return mask # Usage original_size = original.size mask = create_mask(original_size, region=(100, 200, 400, 500)) ``` ### Mask with blur (smooth blend) ```python from PIL import ImageFilter mask = create_mask(image_size, region) mask_blurred = mask.filter(ImageFilter.GaussianBlur(radius=10)) # 매 mask 의 edge 의 soft. ``` ### Outpainting (Diffusers) ```python from diffusers import StableDiffusionXLInpaintPipeline import numpy as np original = Image.open("photo.png") W, H = original.size # Create extended canvas (zoom out) extended_size = (int(W * 1.5), int(H * 1.5)) extended = Image.new('RGB', extended_size, (128, 128, 128)) offset = ((extended_size[0] - W) // 2, (extended_size[1] - H) // 2) extended.paste(original, offset) # Mask: white = generate, black = keep mask = Image.new('RGB', extended_size, 'white') inner_mask = Image.new('RGB', (W, H), 'black') mask.paste(inner_mask, offset) result = pipe( prompt="natural scene continuation, mountain landscape, cinematic", image=extended, mask_image=mask, num_inference_steps=40, guidance_scale=8, ).images[0] ``` ### Upscale (Real-ESRGAN) ```python from realesrgan import RealESRGANer from basicsr.archs.rrdbnet_arch import RRDBNet import torch # 4x upscale model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=4) upscaler = RealESRGANer( scale=4, model_path='RealESRGAN_x4plus.pth', model=model, tile=400, # tile-based for big image half=True, ) import cv2 img = cv2.imread('output.png', cv2.IMREAD_UNCHANGED) upscaled, _ = upscaler.enhance(img, outscale=4) cv2.imwrite('upscaled.png', upscaled) ``` ### ComfyUI workflow (visual node) ``` [LoadImage] → [VAEEncode] → [InpaintModel] → [KSampler] → [VAEDecode] → [SaveImage] ↓ [LoadMask] ↓ [PromptText (region)] ``` ### Img2img (style transfer) ```python from diffusers import StableDiffusionXLImg2ImgPipeline pipe = StableDiffusionXLImg2ImgPipeline.from_pretrained("model") result = pipe( prompt="oil painting style, Renaissance, masterpiece", image=original, strength=0.6, # 매 less change guidance_scale=7.5, ).images[0] ``` ### Multi-stage workflow (orchestration) ```python def refine_image(prompt: str) -> Image.Image: # Stage 1: Generate base = generate(prompt) # Stage 2: Detect defects issues = detect_issues(base) # e.g., {'face': (200, 300, 400, 500), 'hand': (100, 100, 200, 200)} # Stage 3: Inpaint each current = base for issue_type, region in issues.items(): mask = create_mask(current.size, region) current = inpaint(current, mask, prompt=f"perfect {issue_type}") # Stage 4: Upscale final = upscale(current, scale=2) return final ``` ### Face restoration (GFPGAN) ```python from gfpgan import GFPGANer restorer = GFPGANer( model_path='GFPGANv1.4.pth', upscale=2, arch='clean', channel_multiplier=2, bg_upsampler=upscaler, ) cropped, restored, output = restorer.enhance( img, has_aligned=False, only_center_face=False, ) ``` ### IP-Adapter (style reference) ```python from diffusers import StableDiffusionXLPipeline from diffusers.utils import load_image pipe = StableDiffusionXLPipeline.from_pretrained("model") pipe.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter-plus_sdxl_vit-h.safetensors") pipe.set_ip_adapter_scale(0.6) style_image = load_image("style_reference.jpg") result = pipe( prompt="portrait of a woman", ip_adapter_image=style_image, num_inference_steps=30, ).images[0] ``` → 매 style of reference, 매 subject 의 your prompt. ### Photoshop Generative Fill (Adobe API) ```javascript // Adobe Firefly Services API const response = await fetch('https://firefly-api.adobe.io/v3/images/generative-fill', { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ image: { source: { url: 'https://...' } }, mask: { source: { url: 'https://...' } }, prompt: 'mountain landscape', seeds: [1, 2, 3], }), }); ``` ### Batch refinement ```python from concurrent.futures import ThreadPoolExecutor def refine_one(image_url: str, defects: list[dict]) -> str: image = download(image_url) for d in defects: image = inpaint(image, mask=d['mask'], prompt=d['prompt']) return save(image) with ThreadPoolExecutor(max_workers=4) as executor: results = list(executor.map(lambda x: refine_one(x[0], x[1]), tasks)) ``` ## 🤔 의사결정 기준 (Decision Criteria) | 작업 | 추천 도구 | |---|---| | Quick fix small region | Midjourney Vary (Region) | | Photo retouching | Photoshop Generative Fill | | Open / programmatic | Stable Diffusion + Diffusers | | Style transfer | Img2img + IP-Adapter | | Face restoration | GFPGAN / CodeFormer | | Resolution ↑ | Real-ESRGAN / Creative Upscale | | Composition extend | Outpainting (Pan / Zoom) | | Multi-region | ComfyUI batch | **기본값**: Generate base + iterate inpaint per defect + upscale final. ## ⚠️ 모순 및 업데이트 (Contradictions & Updates) - **Mask quality 의 sensitivity**: 매 too tight = seam. 매 too loose = unrelated change. - **Strength 의 trade-off**: 매 high = creative + match break. 매 low = preserve + change 부족. - **Outpaint 의 logical continuation**: 매 model 의 surrounding scene understand 의 limit. - **Upscale 의 hallucination**: 매 detail 의 add 가 not original. - **Inpaint dedicated model vs general**: 매 dedicated 의 better. ## 🔗 지식 연결 (Graph) - 부모: [[AI-Image-Generation]] · [[Image-Editing]] · [[Diffusion-Models]] - 변형: [[Inpainting]] · [[Outpainting]] · [[Img2Img]] · [[Upscale]] · [[ControlNet]] - 응용: [[Photoshop-Generative-Fill]] · [[Midjourney-Vary-Region]] · [[ComfyUI-Workflow]] - Tool: [[Diffusers-Library]] · [[Real-ESRGAN]] · [[GFPGAN]] · [[CodeFormer]] · [[IP-Adapter]] · [[Flux-Fill]] - Adjacent: [[Image-Quality-Optimization-Debugging]] · [[Iterative-Refinement]] · [[Prompt-Engineering]] ## 🤖 LLM 활용 힌트 (How to Use This Knowledge) **언제 이 지식을 쓰는가:** - 매 commercial image 의 fix. - 매 product photo 의 background remove. - 매 portrait 의 face / hand fix. - 매 marketing material 의 multi-resolution. - 매 art project 의 iterative refine. **언제 쓰면 안 되는가:** - 매 from-scratch creation (use generation, not editing). - Specific artist 의 unique style emulation (legal / ethical). - Deepfake / impersonation (illegal). - Print-quality (specialized print workflow). ## ❌ 안티패턴 (Anti-Patterns) - **Mask 의 too tight**: seam. - **모든 defect 의 single inpaint**: quality mix. - **Img2img strength = 0.95**: 매 original 의 lose. - **Upscale 의 too aggressive**: hallucinated detail. - **No iterative review**: 매 1 pass + accept. - **Outpaint 의 narrative break**: scene continuity. - **Specific tool lock-in**: 매 limit 의 ignore. ## 🧪 검증 상태 (Validation) - **정보 상태:** verified (concept-level). - **출처 신뢰도:** B (Stability AI / Diffusers / Adobe Firefly / Midjourney documentation). - **검토 이유:** Manual cleanup. 매 platform 의 evolution. ## 🧬 중복 검사 (Duplicate Check) - **기존 유사 문서:** [[AI-Image-Generation]] (parent), [[AI 이미지 생성 및 편집 워크플로우]] (related), [[AI 이미지 품질 최적화]] (related). - **처리 방식:** KEEP (focused on post-editing tools). - **처리 이유:** Specific to refinement workflow. ## 🕓 변경 이력 (Changelog) | 날짜 | 변경 내용 | 처리 방식 | 신뢰도 | |------|-----------|-----------|--------| | 2026-05-08 | P-Reinforce Phase 1 정규화 | UPDATE | A | | 2026-05-09 | Manual cleanup — 5 tool family + Diffusers code + multi-stage workflow + 안티패턴 추가 | UPDATE | B |