Inpainting

Inpainting is an AI image-editing technique that reconstructs or replaces a masked (selected) region of an image while keeping the rest untouched, with the model generating new content that blends seamlessly with the surrounding pixels in lighting, texture, and perspective. Diffusion-based inpainting models are trained specifically on the masked-reconstruction task: during training, random regions of images are blacked out and the model learns to predict plausible content for the missing area conditioned on the visible surroundings (and, in guided inpainting, a text prompt describing what should appear there). "Outpainting" is the inverse/extension — generating new content beyond the original image's borders to extend the canvas, useful for reformatting a square product photo into a wide banner without cropping out the subject. Why it matters for SaaS builders: inpainting is the engine behind "remove object" photo-editing features (removing a photobomber, a power line, a watermark), product-photo cleanup tools (removing a distracting background element), and creative editing apps that let users select a region and type what they want there instead ("replace the sky with a sunset"). It's also used defensively/positively in dataset cleaning and for restoring damaged or occluded regions in archival photo restoration products. A concrete worked example — a headshot-editing SaaS offering "remove background clutter": (1) user uploads a portrait photo taken in a cluttered home office; (2) the app runs an auto-segmentation model to detect the subject and generates an inverse mask covering everything except the person, then applies a few pixels of edge-feathering so the mask boundary isn't a hard, jagged line; (3) it calls the inpainting API: `POST /v1/inpaint` with the image, the mask, and prompt "clean, softly blurred neutral grey studio background, professional headshot lighting"; (4) the model fills the masked region with a plausible, seamlessly blended studio backdrop, matching the lighting direction and color temperature of the original photo so the subject doesn't look pasted onto a mismatched background; (5) the result is returned in a few seconds, and the app offers 2-3 background style presets (solid grey, soft office blur, outdoor bokeh) generated from the same base photo. Mask quality is the single biggest driver of output quality — sloppy mask edges with hard boundaries produce visible seams or haloing artifacts around the subject, which is why production tools invest specifically in the segmentation and feathering step rather than treating it as an afterthought before the inpainting call itself.

Related terms

More Output & Media terms