AI & Creative Tools

Inpainting and Outpainting: Getting Started

Generating a whole new image when you only wanted to fix one hand is the most common beginner mistake. Masked editing is how you keep the 95% that's already right.

Most people’s image-generation workflow is: write a prompt, look at four results, dislike something small, change the seed, start over. That’s a slot machine, not a practice. Inpainting (regenerating a selected part of an image) and outpainting (generating beyond the edges of one) are how you stop rerolling and start editing.

This guide is tool-agnostic. The controls below exist in ComfyUI, Automatic1111, Krita’s AI plugin, Photoshop’s Generative Fill and Firefly, under slightly different names.

1. What masked generation actually does

You supply an image and a mask — a black-and-white map marking which pixels the model may change. The model regenerates only the masked region, while conditioning on the surrounding pixels so the new content matches in lighting, colour and style.

That conditioning is the whole trick. The model isn’t inventing a hand in a vacuum; it’s inventing a hand that has to plausibly attach to the arm you kept.

2. Denoise strength is the control that matters

If you learn one number, learn this one (some tools call it denoising strength, others just “strength”). It sets how far the masked region is allowed to drift from what’s already there.

  • 0.2–0.4: subtle cleanup. Fix texture, remove a small artifact, tidy an edge. The content stays.
  • 0.5–0.7: meaningful change that respects the existing composition. Change the expression, the material, the colour of a garment.
  • 0.8–1.0: effectively new content in that region. Use when you want something genuinely different, and expect it to fight the surroundings.

Almost every failed inpaint is a denoise value that was too high. If the result doesn’t blend, go down before you change anything else.

3. Mask edges

A hard-edged mask produces a visible seam, because the model has an abrupt boundary between “may change” and “may not.” Two fixes:

  • Feather or blur the mask by a handful of pixels so the transition is gradual.
  • Mask generously. Include some of the surrounding correct area rather than tracing tightly around the flaw. The model needs room to blend, and a tight mask forces the fix into an outline of itself.

4. Inpaint at full resolution

The single biggest quality improvement available. Naive inpainting regenerates your masked area at the scale of the whole image, so fixing an eye in a 1024-pixel portrait means the eye gets maybe 80 pixels of the model’s attention.

“Inpaint at full resolution” (also called “inpaint only masked” or crop-and-stitch) instead crops to the mask, generates at full model resolution, then scales the result back in. That eye now gets the model’s entire 1024-pixel budget. Turn this on for any small detail work.

5. Outpainting

Extending beyond the frame is the same mechanism with the canvas enlarged and everything new treated as masked. Two rules:

  • Extend in modest steps. Adding 25–30% at a time and repeating beats asking for double the canvas in one go, which tends to produce a repeat of the composition rather than a continuation of it.
  • Give the model overlap. The new region should border a decent strip of existing image, or it has nothing to match to.

Your prompt should describe the extended scene, not the original subject. Outpainting a portrait with the portrait prompt will get you a second person.

6. A first project

Take an image you generated and like but didn’t keep, and do three passes:

  1. Fix one flaw — a hand, a distorted object, garbled text — with a feathered mask, full-resolution inpainting, denoise around 0.4.
  2. Change one thing deliberately — a colour, a material, an object — at denoise 0.6.
  3. Outpaint the frame by 30% on one side, with a prompt describing what should be there.

That’s the whole loop, and it’s what separates directing an image from receiving one.