📘 CodingMarble Learn

Raster Graphics

A raster picture is a grid of tiny coloured squares called pixels. Each pixel stores three numbers (R, G, B) from 0 to 255. Editing means changing those numbers: retouching, layers and masks, filters and colour correction. Vector graphics use shapes and maths instead. AI image tools also make raster pictures, so we must use them honestly.

🎬 Step-by-step story

  1. Look at this picture. It is made of tiny coloured squares. Each square is a pixel.
  2. Zoom in on one pixel. It is only three numbers: red, green and blue. Each goes from 0 to 255.
  3. There were two grey specks in the sky. We paint sky colour over them. This is retouching.
  4. Now the picture splits into layers. Sky at the back, sun in the middle, house on top. Each layer can change alone.
  5. A filter changes every pixel with one rule. The grey filter takes the average of red, green and blue.
  6. Your turn. Pick a colour and tap pixels. Try the filters and the layers.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Why does a photo look blocky when I zoom in a lot?

Because it is a grid of fixed squares. Zoom in far enough and each square becomes a visible block.

How can three numbers make millions of colours?

Each number has 256 levels. 256 × 256 × 256 = 16,777,216 different mixes of red, green and blue light.

Does retouching spoil the original photo?

Not if you work on a copy or a new layer. The original numbers stay safe underneath.

Why use layers at all?

So that you can change one thing, such as the sun, without touching the sky or the house. You can also hide or move a layer.

Does a filter add new information to a photo?

No. It only does a sum on the numbers that are already there, the same rule for every pixel.

Is an AI-made picture also made of pixels?

Yes. The AI makes the pixel numbers. Paint and tap pixels in free play to see that any raster picture is only numbers.

What is a raster picture?

A raster picture is a grid of tiny squares. Each square is a pixel (picture element). A pixel has one colour only. When your eyes see thousands of pixels together, they join into a smooth picture.

Photos, screenshots and phone pictures are raster. The size of a raster picture is its resolution: width × height in pixels. A picture of 10 × 8 pixels has 10 × 8 = 80 pixels. More pixels means more detail and a bigger file.

Try it: zoom a photo on your phone as far as it goes. You will see the squares.

Colour in numbers: RGB

A screen makes colour with three tiny lights: Red, Green and Blue. Each light has a level from 0 (off) to 255 (full). That is 256 levels.

Three lights with 256 levels each give 256 × 256 × 256 = 16,777,216 colours. Printers use a different mix, CMYK (cyan, magenta, yellow, black ink).

Colour has three easy ideas: hue (which colour, such as red or blue), saturation (how strong or washed out) and brightness (how light or dark).

Editing and retouching

Editing a raster picture means changing pixel numbers. Cropping removes the outer pixels. Resizing adds or removes pixels. Retouching fixes small faults, such as a speck, a spot or a scratch. The usual way is to copy clean pixels from next to the fault and paint them over it.

Always work on a copy or a new layer, so the original stays safe.

Making a bigger picture from a small one only guesses the new pixels. It cannot bring back detail that was never there.

Layers, masks and collage

A layer is like a clear sheet. You stack sheets: sky, sun, house. What you see is the stack seen from the top. You can move, hide, recolour or delete one sheet without touching the others.

A mask controls what part of a layer you can see. On a layer mask, white shows and black hides. Grey shows a little. Nothing is erased, so you can undo.

A collage puts parts of several pictures into one. Each part sits on its own layer and a mask cuts out its edges.

Filters and colour correction

A filter is one rule used on every pixel. Examples:

Colour correction fixes the look of a photo: brightness (lighter or darker), contrast (gap between dark and light), saturation and white balance (so white looks white, not yellow).

Raster vs vector, formats and business graphics

Vector graphics store shapes as maths: contours (outlines), fill colours, gradients (colour that slowly changes) and text. They stay sharp at any size, so logos, icons and maps are often vector. Raster is better for photos with many tiny colour changes.

RasterVector
Made ofpixelsshapes and curves
Zoom ingets blockystays sharp
Best forphotoslogos, icons
FormatsJPG, PNG, GIFSVG

JPG makes small files and loses a little detail (good for photos). PNG keeps every pixel and can have a see-through background. Business graphics are charts, diagrams and infographics that show numbers clearly. They are often vector so that they print sharply.

AI image generation and honest use

An AI image generator makes a new picture from a text prompt, such as “a red kite over a green field”. It learned patterns from a huge number of pictures. The result is still a raster picture: a grid of pixels.

Rules for honest use:

Try it

Predict, then check. A pixel is (30, 60, 90). Guess what the grey filter gives. Then use the 3D free play: tap the Look tool, tap a pixel, press Grey and compare. (Answer: 60, 60, 60.)

At home: take a photo of your notebook. Open the editor on your phone. Crop it, make it brighter, then undo. Notice that the editor can undo because the original numbers are kept.

Key formulas and definitions

Worked examples

1. How many pixels are in a picture 640 pixels wide and 480 pixels high?

Pixels = 640 × 480 = 307,200.

2. Make the pixel (30, 60, 90) grey with the average rule.

Average = (30 + 60 + 90) ÷ 3 = 60. New pixel = (60, 60, 60).

3. Invert the pixel (200, 100, 0).

255 − 200 = 55, 255 − 100 = 155, 255 − 0 = 255. New pixel = (55, 155, 255).

4. A photo is 100 pixels wide and 50 high. Each pixel uses 3 bytes. What is the raw size?

100 × 50 = 5,000 pixels. 5,000 × 3 = 15,000 bytes (about 15 KB) before compression.

5. A logo is made twice as wide and twice as high. How many times more pixels does a raster logo have? What about a vector logo?

Raster: 2 × 2 = 4 times as many pixels, and the new ones are guessed, so it may look soft. Vector: the shape is redrawn from maths at the new size, so it stays sharp.

Common mistakes

Practice quiz

1. What is a pixel?
2. In RGB, what does the pixel (255, 255, 255) look like?
3. On a layer mask, black does what?
4. Which stays sharp at any size?
5. An AI-made picture is best described as:

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What is the difference between raster and vector graphics?

Raster graphics are grids of pixels and get blocky when you zoom. Vector graphics are shapes stored as maths and stay sharp at any size.

Why do photo filters work so fast?

A filter is a short rule applied to the numbers of each pixel. A phone can do that for millions of pixels in a moment.

Is it wrong to use AI images?

No, but be honest. Tell people when a picture is AI-made, do not fake real events or real people, and respect artists and the tool's rules.

Where this is taught

Ukraine8 класDigital creativity
Ukraine10 класGraphics and multimedia
Ukraine10 класElective: graphic design (35 h)
Ukraine11 класElective: graphic design (35 h)

Learn first

Learn next

Related lessons

All Computer Science lessons