피파 한 줄 정리: Inpainting = mask 안만 새로 생성, 밖은 보존. 손 고치고, 안 좋은 디테일 고치고, 배경 바꾸고 — 이게 generate-from-scratch loop를 끊는 도구야.
Mental model: You've painted a beautiful landscape, but you want to change the sky from blue to a dramatic sunset. Instead of repainting the entire canvas, you tape off everything except the sky, mix your new colors, and paint only within the masked area. The mountains, trees, and lake below stay exactly as they are. That's inpainting — selective editing within a mask while preserving everything outside it.
How Inpainting Works
Inpainting gives you a simple but powerful workflow:
- Start with a generated or real image that's mostly right but needs local changes.
- Draw a mask over the area you want to change (the "inpaint region").
- Write a prompt describing what should appear in the masked area.
- Generate: The model fills the masked region with new content while keeping everything outside the mask untouched.
Original Image Mask Inpainted Result ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ ☀️ sky │ │ ████████████ │ │ 🌅 sunset │ │ │ │ ████████████ │ │ │ │──────────────│ │──────────────│ │──────────────│ │ 🏔️ mountain │ │ │ │ 🏔️ mountain │ │ 🌲 trees │ │ (keep) │ │ 🌲 trees │ │ 🏞️ lake │ │ │ │ 🏞️ lake │ └──────────────┘ └──────────────┘ └──────────────┘
What Inpainting Excels At
- Fixing hands: Generated an amazing portrait but the hands have six fingers? Mask the hands, prompt "a natural hand resting on the table," regenerate.
- Removing unwanted objects: A distracting element appeared? Mask it, prompt the background behind it, let the model reconstruct.
- Changing clothing or accessories: Swap a jacket for a sweater, add glasses, change hair color — all without regenerating the face.
- Replacing backgrounds: Keep the subject, mask everything around them, describe a new environment.
- Fixing text: If text rendered poorly, mask it and either let the model try again or remove it entirely for post-production text addition.
Mask Quality Matters
The precision of your mask directly affects the quality of the inpaint:
- Too tight: If the mask barely covers the problem area, the model doesn't have enough room to generate a coherent replacement. Include some buffer around the target.
- Too loose: If the mask covers too much, you lose good parts of the image unnecessarily. Be selective.
- Feathered edges: Soft mask edges help the new content blend smoothly with the surrounding image. Hard edges can create visible seams.
Key Takeaways
- Inpainting edits a masked region while preserving everything outside it.
- Essential for fixing hands, swapping elements, removing objects, and replacing backgrounds.
- Mask quality matters: include buffer space, use feathered edges, match style in your prompt.
- The generate → inspect → inpaint loop is the core professional workflow.