# Inpainting

> Canonical: https://skillalmanac.com/glossary/inpainting | Last verified: 2026-11-24 | Index status: not offered to search engines

Inpainting is an image-editing technique in which you mask a region of an image and a generative model fills only that region, usually guided by a text prompt, while the rest of the image is meant to stay unchanged.

Also called: AI inpainting, image inpainting, inpaint, generative fill, AI image editing, masked image editing.

## In plain language

Inpainting is a way to repair or change part of a picture without redoing the whole thing. You paint over the area you want changed, for example a stray bin in a holiday photo, and describe what should be there instead, or leave it to blend with the surroundings. The AI then redraws only that patch. It is like asking a restorer to retouch one corner of a painting. The result can still look wrong: edges may show, details may not match, and the tool may alter pixels outside your mask. Edited images can also carry rights and consent issues, particularly if they show real people or someone else's work.

## Technical definition

Inpainting takes a base image, a mask and usually a text prompt. In the Hugging Face Diffusers guide, white mask pixels mark the area to fill and black pixels the area to keep. A diffusion model, often a latent diffusion model, denoises the masked region conditioned on the prompt and the visible pixels. The Diffusers guide notes that checkpoints trained for inpainting tend to blend better but are more likely to change the unmasked area, and that an overlay step can force the unmasked pixels to stay unchanged. The latent diffusion paper (Rombach et al.) reports inpainting as one of the tasks its method was applied to.

## How it shows up when you use agents

Inpainting is an image-editing feature, not an agent feature, but it turns up when an agent or a coding tool produces visual assets. A coding agent that calls an image tool to make a mockup or an illustration may be asked to fix one part of the result, and the right request is an edit of that part, not a fresh generation. A fresh generation can change parts you meant to keep.

The practical steps are simple. Decide the region, make a mask that covers it with a little margin, and write a prompt that describes what belongs inside the mask. A [negative prompt](/glossary/negative-prompt) can steer the model away from unwanted content. The model underneath is usually a [diffusion model](/glossary/diffusion-model), the same family used for [text-to-image](/glossary/text-to-image) generation.

What breaks when it is misunderstood: people assume the unmasked area is guaranteed to be untouched. The Diffusers documentation says inpainting-specific checkpoints are more likely to change it, and describes an overlay method to force it to stay the same, at the cost of less natural transitions. So compare the edit with the original before you use it. If the image will be published, also check rights and whether the edit could mislead viewers. Your next action: keep the original file, save the mask next to it, and note which tool and settings produced the edit so you can repeat or undo it.

## Common confusions

- **Inpainting versus image-to-image.** Image-to-image makes a new image that resembles a given one. According to the Diffusers guide, inpainting does the same but transforms only the masked area.
- **Inpainting versus outpainting.** Inpainting fills a region inside the image. Outpainting extends an image beyond its borders. This page defines inpainting.
- **Inpainting versus text-to-image.** Text-to-image starts from a prompt alone. Inpainting starts from an existing image and a mask.
- **Myth.** The mask is a hard guarantee. It marks where the model should fill, but blending and the choice of model can still alter nearby pixels.

## Worked examples in this catalogue

### [Image generation and editing skill](https://skillalmanac.com/skills/openai/imagegen)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A skill that generates or edits raster images such as mockups, textures and illustrations.

Why it exercises the concept: Editing an existing raster image is the same kind of job as inpainting. The catalogue entry does not say it uses masks, so treat it as adjacent, not as an inpainting tool.

### [image-prompt-direction](https://skillalmanac.com/skills/skill-almanac/image-prompt-direction)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Image prompts written like an art director's brief, then linted for gaps, contradictions and rights problems.

Why it exercises the concept: An inpainting prompt describes the masked patch, and vague or conflicting wording is a common reason a fill looks wrong. This skill is adjacent: it checks prompts, it does not edit images.

### [image-spec-check](https://skillalmanac.com/skills/skill-almanac/image-spec-check)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Exported images checked against your own spec table, with a statement of what to resize, crop, re-export or replace.

Why it exercises the concept: After an edit you still have to check that the file meets its size and format requirements. This is a downstream check, not part of inpainting itself.

## Related terms

- [Diffusion model](https://skillalmanac.com/glossary/diffusion-model.md)
- [Text-to-image](https://skillalmanac.com/glossary/text-to-image.md)
- [Stable Diffusion](https://skillalmanac.com/glossary/stable-diffusion.md)
- [Generative AI (gen AI)](https://skillalmanac.com/glossary/generative-ai.md)
- [Latent space](https://skillalmanac.com/glossary/latent-space.md)
- [Negative prompt](https://skillalmanac.com/glossary/negative-prompt.md)

## Sources

- [Inpainting](https://huggingface.co/docs/diffusers/using-diffusers/inpaint), Hugging Face Diffusers documentation (accessed 2026-11-24)
- [High-Resolution Image Synthesis with Latent Diffusion Models](https://arxiv.org/abs/2112.10752), arXiv (Rombach et al.) (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-24. [Glossary index](https://skillalmanac.com/glossary.md).
