TL;DR: Inpainting changes pixels inside an image's existing frame; outpainting adds pixels beyond it. In 2026 they split across three different mechanisms depending on the tool: a drawn black-and-white mask (Stability, FLUX.1 Fill, GPT Image), a plain-language instruction with no mask at all (Google's Gemini image models, Midjourney's new Edit Model), or a canvas-placement outpaint that takes pixel offsets instead of a mask. Using a masked-inpainting prompt on a tool that reads only instructions does nothing.
What actually separates inpainting from outpainting?
Where the new content lands relative to the image you already have. Hugging Face's diffusers documentation, the closest thing this space has to a vendor-neutral definition, states it directly:
"Inpainting replaces or edits specific areas of an image. This makes it a useful tool for image restoration like removing defects and artifacts, or even replacing an image area with something entirely new. Inpainting relies on a mask to determine which regions of an image to fill in; the area to inpaint is represented by white pixels and the area to keep is represented by black pixels. The white pixels are filled in by the prompt."
Outpainting takes that same fill-the-marked-region idea and applies it past the image's original edges: the source image sits somewhere on a larger canvas, and everything outside its borders is unpainted territory the model has to invent from scratch, guided by what is visible at the seam.
That definition assumes a mask. Plenty of 2026 tools do not use one, which is the entire reason this reference exists.
Do all of these tools actually use a mask?
No, and the three-way split is the single fact a masked-inpainting tutorial gets wrong when it is aimed at the wrong tool.
Mask-based, dedicated endpoints. Stability AI's /v2beta/stable-image/edit/inpaint describes itself as work that intelligently modifies images 'by filling in or replacing specified areas with new content based on the content of a "mask" image.' That mask can be supplied either as a separate image passed to the mask parameter, or derived automatically from the alpha channel of the image parameter. Black Forest Labs' FLUX.1 Fill takes the same shape: "Submits an image generation task with the FLUX.1 Fill [pro] model using an input image and mask. Mask can be applied to alpha channel or submitted as a separate image." OpenAI's GPT Image does too, with one caveat covered below.
Conversational edit, no mask parameter at all. Google's Gemini image-generation guide lists its second editing technique as "2. Inpainting (semantic masking)" and instructs the user to 'Conversationally define a "mask" to edit a specific part of an image while leaving the rest untouched.' There is no mask image field anywhere in this workflow, on Nano Banana Pro or any current Gemini image model. The instruction is the mask. Black Forest Labs' own newer edit models point the same direction: FLUX.2 [pro]'s own description calls it "the recommended default model for image editing and generation." It works from reference images and a text prompt, the same reference-image approach FLUX.2's other presets rely on, with no mask field in its request schema at all.
Canvas-expand, for going past the frame. Covered on its own below, since outpainting has its own parameter shape distinct from either of the above.
How do the mask-based endpoints actually work?
By painting or deriving a black-and-white (or alpha-channel) map of what to touch, then describing what should appear there.
Stability's mask parameter description is explicit about the convention: it "represents, at any pixel, the strength of inpainting based on how dark or light the given pixel is. Completely black pixels represent no inpainting strength while completely white pixels represent maximum strength." If you skip the mask entirely, Stability derives one instead: "one will be derived from the alpha channel of the image parameter." Transparent pixels then get inpainted and opaque pixels are preserved, per the same description.
# Stability inpaint: separate black-and-white mask image, or an alpha-channel image.
curl -f -sS -X POST "https://api.stability.ai/v2beta/stable-image/edit/inpaint" \
-H "authorization: Bearer $STABILITY_API_KEY" \
-H "accept: image/*" \
-F image=@kettle.png \
-F mask=@kettle_mask.png \
-F prompt="a copper teapot instead of the kettle" \
-o kettle_edited.png
FLUX.1 Fill's mask parameter follows the same black-and-white convention, with its own wording: "Black areas (0%) indicate no modification, while white areas (100%) specify areas for inpainting." Its companion tool, flux-tools/erase-v1, flips the labeling for a narrower job, object removal: "White pixels indicate the object to remove; black pixels are preserved."
OpenAI's GPT Image also takes a mask, but with a documented precision limit worth quoting exactly, since it is the honest answer to "why didn't it stay inside my mask": "Masking with GPT Image is entirely prompt-based. The model uses the mask as guidance, but may not follow its exact shape with complete precision." The same guide's mask-requirements section adds a hard technical rule: "The mask image must also contain an alpha channel." A plain black-and-white PNG without one will not validate.
# OpenAI GPT Image edit with a mask. The mask needs an alpha channel, not just black/white.
from openai import OpenAI
client = OpenAI()
result = client.images.edit(
model="gpt-image-1",
image=open("lounge.png", "rb"),
mask=open("mask.png", "rb"), # must carry an alpha channel
prompt="a sunlit indoor lounge area with a pool containing a flamingo",
)
What does a conversational, no-mask edit look like?
A written instruction that names the element to change and tells the model what to leave untouched, with no image mask involved at all. Google's own template for this is a single reusable pattern:
"Using the provided image, change only the [specific element] to [new element/description]. Keep everything else in the image exactly the same, preserving the original style, lighting, and composition."
The precision here comes entirely from how specifically you name the element and how explicitly you tell the model what must not move. There is no separate control for "how strictly should this stay inside a boundary," because there is no boundary object at all, only the sentence.
Midjourney has moved its own inpainting toward the same conversational shape. Its Edit Model help article states the tool "works in three distinct ways." The first is making "changes to an existing image using written instructions." The third is to "Use the Editor to change specific areas of an image (inpainting) and expand its canvas beyond the original frame (outpainting)." That folds what used to be two separate legacy tools into one system. More on that shift below.
How does outpainting actually work, if there's no mask to draw?
By placing the source image on a bigger canvas and telling the model where the edges are, using either pixel offsets or explicit target dimensions, never a black-and-white mask.
Stability's Outpaint endpoint is offset-based: it takes four separate integer fields, left, right, up and down, with the request required to supply at least one of them above zero. Stability's own spec states, "Each of these parameters should be set to a number between 0 and 2000, representing the number of pixels to outpaint in that direction." Its own framing of the whole service: "The Outpaint service inserts additional content in an image to fill in the space in any direction. Compared to other automated or manual attempts to expand the content in an image, the Outpaint service should minimize artifacts and signs that the original image has been edited."
# Stability outpaint: pixel offsets per direction, no mask field exists on this endpoint.
curl -f -sS -X POST "https://api.stability.ai/v2beta/stable-image/edit/outpaint" \
-H "authorization: Bearer $STABILITY_API_KEY" \
-H "accept: image/*" \
-F image=@portrait.png \
-F right=512 \
-F left=512 \
-F prompt="the same room, wider shot" \
-o portrait_wide.png
Black Forest Labs' flux-tools/outpainting-v1 takes the opposite shape of the same idea, canvas-placement instead of directional padding. Its own description: "Submits an outpainting task. The input image is placed on a (width, height) canvas at the given offset, and the surrounding region is generated by a FLUX outpainting model." You supply a target width and height plus an optional reference_offset_x and reference_offset_y rather than four separate direction values.
| Vendor / endpoint | Mechanism | Key fields | Mask required? |
|---|---|---|---|
Stability edit/inpaint | Mask-based | image, mask (or alpha channel), prompt | Optional (falls back to alpha channel) |
Stability edit/outpaint | Directional padding | left, right, up, down (pixels, 0-2000) | No mask field exists |
Stability edit/search-and-replace | Text-only object swap | image, prompt, search_prompt | No |
FLUX.1 Fill (flux-pro-1.0-fill) | Mask-based | image, mask, prompt | Yes (or alpha channel) |
FLUX erase-v1 | Mask-based removal | image, mask | Yes |
FLUX outpainting-v1 | Canvas placement | input_image, width, height, offsets | No mask field exists |
| OpenAI GPT Image edit | Mask-based, prompt-guided | image, mask (needs alpha channel), prompt | Optional, loosely followed |
| Google Gemini / Nano Banana | Conversational, no mask | source image + text instruction | No mask field exists |
| Midjourney Edit Model (V8.1/V8.2) | Instruction or Editor brush/select | text instruction, up to 4 reference images, or drawn selection | Only inside the Editor's brush tools |
Is Search and Replace its own mechanism, or a variant of inpainting?
Stability documents it as a text-only variant of the same masked operation, explicitly built to skip the mask step: "The Search and Replace service is a specific version of inpainting that does not require a mask. Instead, users can leverage a search_prompt to identify an object in simple language to be replaced. The service will automatically segment the object and replace it with the object requested in the prompt." You send two prompts, not one: search_prompt names what to find, prompt describes what should appear in its place.
# Stability Search and Replace: two prompts, zero masks.
curl -f -sS -X POST "https://api.stability.ai/v2beta/stable-image/edit/search-and-replace" \
-H "authorization: Bearer $STABILITY_API_KEY" \
-H "accept: image/*" \
-F image=@lounge.png \
-F search_prompt="the flamingo float in the pool" \
-F prompt="a red canoe" \
-o lounge_edited.png
This sits between the two poles: it is mask-free like Gemini's semantic masking, but it is still a dedicated single-purpose endpoint rather than a general instruction, which is the practical difference between "conversational edit" and "search and replace" even though both skip drawing a mask.
What changed on Midjourney, specifically?
Three separate legacy tools folded into one instruction-and-Editor system. Before the Edit Model, a Discord user reached for Vary Region to touch up part of an image, Pan to extend one edge, or Zoom Out to reveal more of the scene, each a distinct command with its own mechanics. Midjourney's Pan article still describes its own version as canvas expansion: it 'expands the "canvas" of your image in a direction you choose. The extra space is then filled with new details that match the original image, using guidance from your prompt.' Zoom Out is framed as the same idea at a different scale, with its own documented range: "Zoom values can range from 1.0 to 2.0." Its own article adds a note that "when you zoom out, it doesn't change the actual size of your image in pixels".
The Editor help article, updated August 28, 2026, states the current position plainly: "Inpainting and outpainting now use the new Edit Model for V8.X." Under that model, the Editor's Paint tools still work by drawing. Its own description: "Use the Erase brush to select portions of your image that you want to change and regenerate." Its Smart Select tool description reads, "Use this tool to create a selection mask over parts of your image that you can erase." So Midjourney's web Editor is genuinely mask-based under the hood, even while its main new entry point, typed instructions plus reference images, is not.
Which mechanism should you actually reach for?
Whichever one your tool documents, since none of the three substitutes for another.
Reach for a drawn mask when you need the edit confined to an exact, irregular shape and your tool is Stability, FLUX.1 Fill, or GPT Image with its documented precision caveat in mind. Reach for a plain-language instruction when your tool is Gemini's image models or Midjourney's Edit Model outside the Editor, and be as specific as the element name and the "keep everything else the same" clause allow; there is no shape control to fall back on. Reach for outpainting only when the goal is genuinely new canvas beyond the original frame, not touching up something already inside it, and expect a pixel-offset or canvas-placement field, never a mask, on every endpoint checked here.
Prompt Architects writes the instruction and the mask-region description; it does not draw the mask file itself, run the edit, or decide which of these three mechanisms your target tool supports. Confirming that before you write the prompt is the one step no amount of prompt craft replaces, in the same way that negative prompt support varies by model rather than by convention and background replacement prompting differs by which of these same mechanisms a tool offers.
Every quote above was fetched directly on September 3, 2026: Stability's live /v2alpha/openapi spec, Black Forest Labs' api.bfl.ai/openapi.json, OpenAI's platform.openai.com/docs/guides/image-generation, Google's ai.google.dev/gemini-api/docs/image-generation, Midjourney's Editor, Edit Model, Pan, Vary Region and Zoom Out help articles, and Hugging Face's diffusers inpainting guide. Vendors reshuffle these endpoints often; re-check the mechanism before publishing a workflow built on this reference.
Stop rewriting prompts. Start shipping.
Works with ChatGPT, Claude, Gemini, Grok, Midjourney, Ideogram, Veo3 & Kling. 4.8★ on the Chrome Web Store.
Create An Account