Skip to content
English
  • There are no suggestions because the search field is empty.

Inpainting (via API, or Brand Studio)

Inpainting with Stability AI

Overview

Inpainting allows you to modify or replace specific regions of an existing image using a mask and a text prompt. Instead of generating a completely new image, the model fills only the masked area while preserving the rest of the original image.

Common use cases include:

  • Removing objects or defects from images

  • Replacing elements (e.g., logos, backgrounds, objects)

  • Fixing artifacts such as hands or faces

  • Localized style adjustments

This guide explains how to perform inpainting using the Stability AI Platform.


Prerequisites

Before starting, ensure you have:

  • A Stability AI Platform account or Brand Studio subscription

  • An API key

  • An input image

  • A mask image indicating which region should be modified

  • Basic familiarity with REST API requests

Optional:

  • Image editing software for creating masks (e.g., Photoshop, GIMP)


How Inpainting Works

Inpainting uses three key inputs:

Input Description
Input Image The original image that will be edited
Mask A black/white or transparent image defining editable areas
Prompt Text describing the desired result

The model generates new content only inside the masked region while keeping unmasked areas intact.


Inpainting Workflow

Step 1 — Prepare the Input Image

Upload or provide the image you want to edit.

Recommendations:

  • Use high-quality images

  • Prefer resolutions supported by the model

  • Avoid heavy compression artifacts


Step 2 — Create a Mask

The mask determines which pixels the model can modify.

Mask conventions:

  • White / Transparent areas: Regions that will be regenerated

  • Black / Opaque areas: Regions that remain unchanged

Tips:

  • Extend the mask slightly beyond the object you want to remove

  • Use soft edges or feathering for better blending


Step 3 — Define the Prompt

Write a prompt describing the desired content for the masked region.

Example:

 
A natural rocky shoreline with ocean waves and soft sunset lighting
 

Prompt tips:

  • Describe the entire scene, not only the masked region

  • Use negative prompts if needed to prevent unwanted elements. This applies to concepts rather than literal objects. For example, using "Eiffel Tower" in negative prompting will not likely remove the object. However using "cloudy" or "overcast" in negative prompting will usually induce a sunny depiction of a landscape photo of Paris.

  • Keep prompts succinct.