Watch video · 6:04
Module 01 · Mental building blocks · Lesson 2

Thinking in Pixels: How AI Image Models Work

One simple picture for every image model you'll use: a grid of pixels, and the order a model fills it in. Then how it uses your words, your reference images and your edits, and what makes an image cost more.

You type a sentence and a picture appears. Then you ask for one small change, and the face changes too. Or the label on your product comes out as gibberish. It all feels random until you see what the model is actually doing.

In the first lesson you saw what AI saves. Now, how it works. This lesson gives you one mental picture that explains all of it, thinking in pixels: an image is a grid of pixels, and every image model is choosing a colour for each one. No maths. Just the picture. Every lesson after this one builds on it.

Why you shouldn't skip the prep

An image is a grid of pixels

A portrait, then a zoom on her eye, then an extreme zoom where the square pixels are visible, with one pixel's colour numbers shown
The same photo at three zoom levels. At the end, you can count the squares.

Zoom far enough into any photo and it turns into blocks of colour. Each block is a pixel: the smallest piece of an image, holding exactly one colour.

That colour is a mix of red, green and blue light. A little of each makes a dark colour; a lot of all three makes white.

Seven colour swatches with their red, green and blue amounts
Every colour on your screen is a mix of red, green and blue.

Resolution is the size of the grid. A 1080p image has about 2 million pixels. 4K has four times as many. So an image model's whole job is to choose millions of colours that agree with each other, and look like your prompt.

Text-to-image: from static to a picture

Most image models don't paint left to right, like a printer. They start with the whole grid full of random static, every pixel a random colour, and clean it up.

Five frames from static to a clear desert village street
Illustration. Big shapes and colours come first; fine detail comes last.

At each step, the model looks at the entire picture and nudges every pixel a little closer to what your words describe. Step by step, the static becomes a picture. This is called diffusion. Flux, Stable Diffusion, Seedream and Google's Imagen all work this way. Think of a sculptor: big shapes first, then the face, then the eyelashes. Your prompt tells the model which statue to find.

How did it learn that? By practising the opposite. Millions of real photos were buried in static, step by step, and the model learned to guess what static was added. Guess it well enough, and you can take it away.

Every step costs money. Each step means the model looks at the whole picture again. More steps means more work for the computer, a longer wait and a higher price. That's the trade the fast versions of a model make: fewer steps, a little less detail.

A photo of a village street with more and more noise until it is pure static
Training: noise is added, a little at a time.
  • Same prompt, different picture: every image starts from different random static (the seed).
  • Vague prompts give average pictures: if your words don't steer the cleaning, the model falls back on the most typical version.
  • Small details go wrong first: label text, fingers and earrings come last, with few pixels to work with.

Other ways models make the pixels

Not every model cleans static. There are four families (kinds) of model. They differ in the order they choose the pixels in, and that changes how long they take:

Four rows: GAN in one pass, diffusion cleaning static, autoregressive tile by tile, masked filling random tiles
Illustration. The same street, made four ways.
Family (examples)How the pixels appearTime and cost
Diffusion (Flux, Stable Diffusion, Seedream, Imagen)Whole picture, sharper every stepMore steps, more cost
Autoregressive (OpenAI describes ChatGPT's image model this way)One tile at a time, each looking at the tiles before itMany turns: a bigger picture takes longer
Masked (Google's research model Muse)Every tile hidden; the surest ones filled each roundFewer rounds, less waiting
GAN (older)All at once, in one passVery fast, but hard to steer with words
Many new models mix families.

You don't need to know which family a model is to use it. The mental picture holds either way: the model is choosing pixels, guided by your words. Image models compared shows which family each model you'll use belongs to.

Image-to-image: starting from your picture

Give the model a picture as well as words, and there are a few ways it can use it.

1. As the starting point. Instead of pure static, the model sprinkles some noise over your image, then cleans it up again, steered by your prompt. A setting called strength (or denoise) decides how much noise.

A photo of a village street, then the same photo covered in 30, 60 and 90 percent noise
Low strength keeps your layout and colours. High strength keeps almost nothing.

2. As reference images. This is how most image-to-image work is done today. Say you attach three: a woman, a bottle and a kitchen. The model doesn't cut and paste them. It reads each picture and turns it into labels: her face and green shirt, a white tube with a green cap, a bright kitchen with a stone counter. Then it draws a brand new picture from static, checking those labels and your prompt at every step.

Three reference images (a woman, a white tube with a green cap, a kitchen), each with labels, and the new picture of her drinking at the counter with the tube
Frames from an ad we made. All three references end up in one new picture.

Nano Banana, GPT Image 2, FLUX.2 and Seedream can all take several references. Each extra reference is more for the model to read, so it adds a little work.

3. As the picture to edit. Editing models use the same trick on one picture. Your picture is cut into patches, and each patch becomes a set of numbers describing what's there: this one says face, this one hair, this one T-shirt. Then the model makes a fresh image. Where nothing should change, it tries to keep the same numbers. Where you asked for a change, it draws something new.

A character sheet, then the same sheet cut into a grid of patches, each turned into numbers
Nothing is pasted in. Everything is redrawn from what the numbers describe.
ReferenceThe approved sheet
Character sheet of a man in a charcoal t-shirt and jeans
EditedAsked: a blazer instead of the T-shirt
The same man, same face and build, in a navy blazer and white shirt; his trousers and shoes changed too

Because the whole picture is drawn again, an editing model sometimes changes things you never asked for: a slightly different face, a moved hand, new text on a label. Above, the trousers and shoes changed too. So ask for one change only, and say what must stay the same. And when something really must not change, use inpainting. That's the method in the character sheet lesson.

Keep everything in the attached image the same: the face, hair, body and pose. Change only one thing: [the t-shirt] becomes [a navy blazer over a white shirt].

Inpainting, outpainting and upscaling

Inpainting is the most precise edit. You paint a mask over one area. Only the pixels under the mask are turned back into static and redrawn. Every pixel outside it stays exactly as it was, so a face can't drift, because it is never redrawn. Photoshop's Generative Fill and Flux Fill work like this. It isn't much cheaper than a normal image: the model still looks at the whole picture to make the new part fit.

A character sheet with the outfit masked in pink, the masked area turned to static, half cleaned, then finished in a blazer while the faces stay identical
Inpainting: the faces never change, because their pixels were never touched.

Outpainting is the same idea pointed outwards. Say you have a square picture and need it wide for YouTube, or tall for Reels. You could crop it and lose the top and bottom. Or you can grow the canvas: the new edges start as static, and the model imagines what could be there, matching the picture you already have. Photoshop calls this Generative Expand. The bigger the new area, the more there is to draw.

A square image, then a wider canvas whose border is static, then cleaned, then a full wide picture
Outpainting: only the new border is generated.

Upscaling adds pixels. Going from 1080p to 4K means four times as many pixels in the same picture. Each old pixel becomes four squares, and the new squares start empty. The model fills them with believable detail, like skin texture and sharp edges. Topaz Gigapixel and Magnific are popular upscalers.

A 1080p grid of an eye, then each square split into four with the new ones empty, then all squares filled with finer detail
Upscaling: new squares, filled with detail.

More pixels means more work, so a 4K image usually costs more than a 1080p one. And an upscaler can sharpen a face, but it can't fix a face that was drawn wrong.

The mental picture to keep

  • An image is a grid of pixels; a model chooses a colour for each one.
  • Text-to-image turns static into a picture, or builds it tile by tile.
  • Image-to-image reads your pictures as labels, and draws fresh.
  • Editing redraws everything. Inpainting redraws only the mask.
  • More steps, more pixels or more references all mean more work, and a higher price.
  • If something has to match, attach that something. Words alone give you a stranger.

Quick answers

Does an AI image model paint pixel by pixel?

Most don't. Diffusion models start from static and clean the whole picture at once, step by step. Autoregressive models do build it piece by piece, but in tiles, not single pixels.

Why does the same prompt give a different image every time?

Each image starts from different random static, called the seed. Same seed and settings give the same image.

What's the difference between image-to-image and inpainting?

Image-to-image redraws the whole picture from a noisy copy or a reference. Inpainting redraws only the area you mask; every other pixel stays exactly the same.

Why did my edit change the face?

Editing redraws everything from what it read in your picture. Ask for one change only, say what must stay, or use inpainting to protect the face.

Is GPT Image 2 a diffusion model?

OpenAI hasn't published how GPT Image 2 is built. What matters for you: it takes a prompt alone, or a prompt plus reference images.

What makes an AI image cost more?

More work for the model: more steps, a bigger image (4K has four times the pixels of 1080p) and more reference images to read. Fast versions use fewer steps, so they're cheaper, with a little less detail.

Why do AI images get text and hands wrong?

They're small and detailed, so they get few pixels and are decided last. Newer models are much better, but always zoom in and check.

Keep going

‹›

Now make a few million pixels of your own.

On OpenDirector, GPT Image 2 takes a prompt on its own, or a prompt plus your reference images.

Start in OpenDirector →
© 2026 OpenDirector — AI video and image studio. A SurgeGrowth product. Privacy · Terms · Cookie settings