Making Things with AILesson 31 of 84

Module 4 · Control: getting the picture you actually need

Masks, feathering and the context window

In this lesson

  • 8 min read
  • 7 reading sections
  • Knowledge check
  • Lesson 3 of 9 in this chapter

This chapter’s goalTake a nearly-right generation to a finished deliverable using the appropriate mechanism at each stage (denoise strength, masked regeneration, a conditioning map, a small fine-tune, an upscaler and a manual composite) and say which of those a given defect requires.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available
One inpaint, and where the extra detail comes fromMask theproblem, plushalf its ownwidthA tight maskleaves no roomto placeanything. Afeather of fourto sixteenpixels stops theboundary landingon a single lineof pixels andannouncingitself.Crop a contextarea around itThis crop is themodel’s entireview of thescene. Too tightand it cannotsee the lightsource, so itinvents one,which is why arepair comesback lit wrong.Scale the cropup to themodel’s nativesizeA face worthseven latentcells in thewhole picturenow gets thewhole grid. Itis not tryingharder; it hassixteen timesthe cells.Denoise, withthe outsideoverwrittenevery stepOnly the insideof the mask isfree to change.The surroundingreal pixelscondition it atevery step,which is whycolour andlighting matchwithout beingdescribed.Scale back andblendThe repair ispasted into theoriginal throughthe featherededge.Outpainting is the same machinery pointed outwards: pad the canvas, mask the new area, and extend insteps of 128 or 256 pixels so each step still has context to hold on to.
Outpainting is the same machinery pointed outwards: pad the canvas, mask the new area, and extend in steps of 128 or 256 pixels so each step still has context to hold on to.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 8Free · no account needed
Lesson steps

What a mask actually does

Inpainting is the same denoising loop with one addition. At every step, the parts of the latent outside your mask are overwritten with the correctly-noised version of the original image. Only the inside of the mask is free to change.

That means the region being regenerated is surrounded, at every step, by the real picture. The model is not repairing in isolation; it is completing a scene it can see. This is why inpainting produces results that match lighting and colour without being told to, and why it is a different and far more reliable tool than regenerating the whole image and hoping.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Stuck on something?Ask Yetunde, your AI tutor

How to cite: Addaly (2026) ‘Masks, feathering and the context window’, in Making Things with AI. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/making-things-with-ai/masks-and-inpainting (Accessed: 29 November 2026).