AdpictoAdpicto
FeaturesPricingFAQ
日本語English
LoginStart FreeStart
FeaturesPricingFAQLogin
日本語English
Back to Blog
How-to

gpt-image-2 Inpainting Guide: Masks, Prompts, and Fixes

Learn gpt-image-2 inpainting for social image edits: prepare masks, write masked-region prompts, run multi-pass fixes, and avoid seams or edge bleed.

Adpicto TeamJune 27, 2026

Why this guide is only about inpainting

If you searched for GPT Image 2 inpainting, you probably do not need a general tour of AI image editing. You need to know how to mark the part of an image that should change, how to write a prompt for that specific region, and how to fix the visible artifacts that show up near edges. For the broader editing map, including variations and outpainting, start with our gpt-image-2 image editing workflow. This article stays narrow on purpose: masks, masked-region prompts, multi-pass repair, and QA for social images.

The distinction matters because inpainting fails differently from generation. A normal text-to-image prompt can be loosely directional. An inpainting prompt has to negotiate with existing pixels. The edited area must look new, while the surrounding image must look untouched. Most bad results come from a weak mask, a prompt that forgets the surrounding scene, or a single-pass workflow that asks the model to solve too much at once.

TL;DR

  • Inpainting is best when one region must change and the rest of the image should remain stable.
  • For OpenAI Images API mask editing, the source image and mask should share the same pixel dimensions.
  • Transparent mask pixels mark the area to edit; opaque pixels mark the area to preserve.
  • Leave a small feather around real-world edges so the model can blend light, shadow, texture, and contact points.
  • Prompt the masked region as a replacement that belongs inside the existing scene, not as a standalone object.
  • Use multiple small passes for difficult edits: broad replacement, edge cleanup, then final detail correction.
  • Adpicto's in-app edit flow is prompt-based, not a mask-upload UI. It routes edits to gpt-image-2 by default, with Gemini available only when `IMAGE_EDIT_PROVIDER=gemini`.

What inpainting actually means in gpt-image-2

Inpainting with gpt-image-2 is an OpenAI Images API technique where you submit a source image, a mask image, and a prompt for the masked region. In the alpha-mask convention, transparent pixels are regenerated and opaque pixels are preserved. Adpicto's own app edit flow is related but different: you provide a source image and describe the change in natural language, and the current default edit provider is OpenAI/gpt-image-2 rather than an explicit user-uploaded mask workflow.

Step 1: prepare the source image before the mask

The source image should already be close to the final social crop. Inpainting is not a rescue tool for every layout problem at once. If you need a square product shot for feed, a vertical cover, and a horizontal ad crop, prepare each canvas first. Then mask inside that canvas.

Before you draw the mask, decide three things:

  • The output crop. Work at the aspect ratio you intend to publish. Do not mask a square and then expect a vertical version to preserve the same edge behavior.
  • The true edit target. Name the smallest region that must change: background, cup, sleeve logo, product label, doorway, shadow patch, empty corner.
  • The preservation boundary. Identify what must not move: face, hand pose, product shape, logo, typography, jewelry, reflection, or hard shadow.
This planning step sounds basic, but it prevents the most common mistake: making a mask that matches the object you are thinking about rather than the pixels that need to be regenerated. If a replacement object needs a new contact shadow, the mask must include enough floor or surface for that shadow. If a background swap needs light to wrap around hair, the mask needs a little edge room around the silhouette.

Keep a layered working file. A useful setup is source image at the bottom, selection or vector path above it, and a mask export layer at the top. Name versions by intent: `background-soft-shadow`, `cup-wide-edge`, `label-tight`, `hair-feather`. Version names make later QA faster because reviewers can see what each pass was supposed to test.

Step 2: build a mask that gives the model room to blend

For OpenAI Images API mask editing, use a PNG mask at the same pixel dimensions as the source. The practical alpha rule is simple: transparent means edit, opaque means keep. Avoid exporting a visually white-and-black mask that has lost alpha information unless the toolchain you are using explicitly maps those colors correctly.

A good mask is rarely a perfect cutout. It is a controlled edit area with enough margin for the model to blend.

Use this sequence:

    • Duplicate the source image in your image editor.
    • Select the region to change with the most precise tool available: pen path for products, object selection for simple silhouettes, manual brush for hair or fabric.
    • Expand the selection slightly when the new pixels need to meet old pixels naturally.
    • Add a soft feather around organic or shadowed edges, usually around 5-10 px for common social image sizes.
    • Export the mask as PNG with alpha.
    • Confirm the mask and source dimensions match exactly before sending the edit request.
Different subjects want different mask behavior:
  • Product background swap. Keep the product opaque and make the background transparent. Include a small contact-shadow area if the product sits on a surface.
  • Object replacement. Make the object and immediate edge context transparent. If the object is held by a hand, preserve the hand unless fingers must wrap differently.
  • Text correction. Mask the entire faulty text area plus a little surrounding surface. Tight masks around individual letters often leave old strokes or texture ghosts.
  • Skin, fabric, or hair cleanup. Use softer masks and smaller passes. Hard-edge masks on organic detail tend to create obvious cut lines.
  • Reflection or shadow repair. Mask the visible artifact and the area where the shadow or reflection should naturally fade. The fade is part of the edit.
After export, inspect the mask at full size. Zoomed-out masks hide mistakes. Look for accidental transparent pinholes, clipped corners, semi-transparent areas you did not intend, and a mismatch between the mask edge and the real object boundary.

Step 3: write the masked-region prompt as a replacement brief

An inpainting prompt should describe the desired result inside the mask and how that result relates to the unmasked image. Do not write it like a full scene prompt unless the full scene is actually inside the mask.

Use this structure:

  • Replacement instruction: what the masked region should become.
  • Scene matching: lighting direction, color temperature, material, perspective, depth of field.
  • Preservation instruction: what must stay unchanged outside the mask.
  • Negative constraints: what should not appear in the new pixels.
  • Output context: social crop or platform format if it affects composition.
For a background swap:
Replace the masked background with a clean warm off-white studio surface. Match the existing product lighting from the upper left, keep a soft natural contact shadow beneath the product, and preserve the product shape, label, color, and reflections exactly. No extra objects, no text, no logo, no new hands.

For a product label repair:

Replace only the masked label area with a plain smooth label surface matching the bottle curvature and gloss. Keep the bottle shape, cap, highlights, background, and camera angle unchanged. No readable text, no decorative marks, no change to the surrounding plastic.

For a wardrobe color edit:

Replace the masked jacket fabric with deep forest green cotton twill. Preserve the person's pose, face, hands, background, and existing light direction. Keep folds and seams natural to the original garment. No pattern, no logo, no change to hair or skin.

The important word is "replace." It tells the model the mask is the working region. The preservation clauses tell it where to stop. If the new result must attach to a real surface, ask for the attachment: shadow under the object, light wrap on the edge, fabric fold continuity, reflection fade, or surface grain continuing under the repair.

Step 4: use multi-pass inpainting instead of one heroic prompt

One-pass inpainting is tempting because it feels efficient. It is also where many edits get overworked. For difficult images, split the work into passes where each pass has one job.

A reliable sequence looks like this:

    • Broad replacement pass. Use the mask that covers the main edit area and ask for the main replacement.
    • Edge cleanup pass. Create a thinner mask around the boundary where old and new pixels meet. Prompt only for blending, shadow, texture, or color continuity.
    • Detail correction pass. Mask small visible mistakes: a warped label edge, leftover object fragment, odd reflection, or unwanted text.
    • Hold pass if needed. If a later pass starts changing the subject, shrink the mask and strengthen preservation language.
The mask usually gets smaller as the edit improves. Start with enough area to generate the new object or background. Then reduce the mask to the problem boundary. This keeps each edit from re-deciding the whole scene.

Do not stack many unrelated fixes into one mask. "Replace the background, fix the hand, remove the text, make the product glossier, and extend the crop" gives the model too many degrees of freedom. Run those as separate edits, or decide which issue actually blocks shipping.

Troubleshooting seams, edge bleed, color mismatch, and ghosting

Most inpainting issues can be diagnosed by looking at the mask edge.

Visible seam. The new region meets the old region with a hard line. Use a cleanup mask that straddles the boundary and prompt for texture and light continuity. If the edge is organic, add a softer feather.

Edge bleed. The edit changes pixels that should have stayed stable. Shrink the mask, make the preserved object fully opaque, and add a direct preservation clause such as "do not alter the product silhouette or label."

Color mismatch. The edited area has a different white balance or contrast from the source. Prompt with the source light direction and color temperature rather than a new mood. "Match the existing warm window light from the left" is better than "beautiful studio lighting."

Ghosting. Fragments of the old object remain. Expand the mask slightly around the old object, especially where texture or reflections carried its outline. For old text, mask the whole label or sign panel, not just letter strokes.

Floating replacement. The new object looks pasted in. Include the surface interaction in the prompt: contact shadow, reflection, fabric pressure, hand occlusion, or perspective match.

Mask and image dimension mismatch. If the output looks shifted, cropped, or padded, stop troubleshooting the prompt. Confirm the source and mask dimensions are identical and that the mask was exported from the same canvas.

Prompt fights the source. A cold neon replacement in a warm daylight image will look wrong even with a perfect mask. Either ask for a replacement that belongs to the source lighting or plan a separate global color pass after the inpaint.

Batch inpainting QA for social-image production

Inpainting becomes operational when you can review multiple edits without guessing what changed. For an ecommerce social workflow, that usually means product backgrounds, label corrections, seasonal surface changes, and platform crops. The QA process should make those edits boring.

Use a simple review sheet for each image:

  • Source file name
  • Edit objective
  • Mask version
  • Prompt version
  • Preserved elements
  • Known risk area
  • Pass status
  • Reviewer note
Review the output in three views. First, compare the full image at feed size, because that is how most people will see it. Second, inspect the mask boundary at full size. Third, compare the source and output side by side for unintended changes outside the mask.

For team workflows, assign one person to judge the objective and another to check preservation. The first reviewer asks, "Did the masked region become what we wanted?" The second asks, "Did anything outside the intended edit change?" Keeping those roles separate catches more issues than a general "looks good" review.

When using Adpicto for in-app edits, remember that the app edit path is prompt-based. You describe the desired change against a source image, and the current default routes to gpt-image-2. If your workflow requires a hand-authored alpha mask, treat that as a direct gpt-image-2/OpenAI Images API step outside the app UI, then bring the finished visual back into your normal content process.

Inpainting vs variations vs outpainting

Use inpainting when you know the region to change. Use variations when you want a related alternative and can tolerate detail drift. Use outpainting when the new area is outside the original canvas. That is the short version; the hub article covers the full decision tree, so keep this spoke focused on the mask and the boundary.

When to route away from gpt-image-2

For explicit mask work, gpt-image-2 through the OpenAI Images API is the relevant technique. There are still times to consider another route: prompt-only edits where a mask is unnecessary, image jobs where your internal stack has selected Gemini through `IMAGE_EDIT_PROVIDER=gemini`, or broader generation workflows where the model choice is tied to tier and output format. For that wider context, see the gpt-image-2 and Nano Banana 2 multi-model strategy.

The practical rule is simple: do not prepare a mask if the edit does not need mask precision. If the request is "make the image feel more minimal," a prompt-based edit may be enough. If the request is "change only the left product label and keep the rest untouched," use inpainting.

Use prompt recipes when text or layout is involved

Inpainting often touches text and layout, even when the goal is not typography. A product label, sign, app screenshot, price card, or carousel panel can break if the prompt asks the model to invent readable small type. For copy-paste structures that separate layout, text, and mask instructions, use the gpt-image-2 text and layout prompt recipes alongside this guide.

For masked areas that contain text, decide whether the final text should be generated or overlaid later. If it needs to be exact, generate a clean surface and add real type in design software. If it only needs to remove broken text, prompt for "no readable text" rather than asking the model to replace it with a precise phrase.

Need to fix one region without rebuilding the whole post? Start with Adpicto free — no credit card required, and the same prompt discipline carries into prompt-based image edits.

Make inpainting boring enough to ship

Good inpainting is not dramatic. The viewer should not notice it. The edited region should inherit the source image's light, texture, perspective, and noise level, while the protected area stays stable.

That happens when the workflow is controlled: prepare the final crop, build a mask with intentional edge room, write a prompt that belongs to the existing scene, and use small cleanup passes instead of one overloaded request. Once that loop is repeatable, inpainting becomes less like image generation and more like production retouching with a faster first draft.

gpt-image-2 InpaintingAI InpaintingImage MaskAI Image Editing2026

Related Articles

How-to

Instagram for Freelancers (2026): Attract Higher-Paying Clients With Portfolio, Process, and Proof

How freelancers and solopreneurs turn Instagram into a steady client pipeline in 2026 — portfolio carousels, process Reels, testimonial highlights, and a profile that converts visits into discovery calls.

How-to

Instagram for Freelancers (2026): Win Higher-Paying Clients and Long-Term Retainers

How freelancers and solopreneurs use Instagram in 2026 to move from one-off gigs to premium retainers — portfolio carousels, process Reels, testimonial loops, and the bio-to-DM funnel that actually closes contracts.

How-to

Twitter Marketing for Ecommerce: A DTC Conversion Playbook (2026)

How DTC ecommerce brands turn X (Twitter) into a real conversion channel — support replies, launch threads, drops, and meme adoption that move carts, not just impressions.

Try this image workflow in Adpicto

Adpicto routes between gpt-image-2 and Nano Banana 2 automatically — generate and edit images straight from a prompt.

Create an image free

No credit card required · 5 free images per month

AdpictoAdpicto

Goal-driven SNS posts. Register your service info once, then let AI assemble the layout, image, and copy that fits each goal.

Use Cases

  • Small Business
  • E-commerce
  • Restaurants
  • Beauty Salon
  • Real Estate
  • Fitness
  • Dental
  • Cafe
  • Fashion
  • Hospitality
  • Education
  • Pet Care
  • Freelancer
  • Photography
  • Medical

Platforms

  • Instagram
  • X (Twitter)
  • TikTok
  • Facebook
  • LinkedIn

Compare

  • vs Canva
  • vs Buffer
  • vs Later
  • vs Hootsuite
  • vs Adobe Express
  • vs Ocoya
  • vs Predis AI
  • All comparisons →

Resources

  • Blog
  • Help
  • Contact

Legal

  • Terms of Service
  • Privacy Policy
  • Legal Information

© 2026 Adpicto. All rights reserved.