Skip to content
tezvyn:

Digital Images as Grids of Pixels

Source: Wikipedia: Raster graphicsEasyHow cards are made

Digital Images as Grids of Pixels

Think of a digital image as a mosaic of tiny colored tiles called pixels. This 'raster' method stores the exact color of each point, making it perfect for photos. The footgun: scaling up reveals the grid, causing blurriness or pixelation.

Why it exists

To capture and represent the complex, continuous color and light variations of the real world in a digital format. Computers need a structured, discrete way to store this visual information, and a simple grid of colored points is the most straightforward method.

The mental model

Imagine a digital image as a piece of graph paper or a mosaic. Each small square on the paper is a 'pixel' (picture element), and you fill each square with a single, solid color. When you stand back, the individual colored squares blend together to form a complete picture. The entire image is just a collection of these colored squares arranged in a rectangular grid.

How it works

A raster image is defined by its dimensions (width and height in pixels) and its color depth. For each pixel in its grid, the image file stores a value representing its color. For a simple black and white image, this might be a single bit (0 for black, 1 for white). For a full-color image, it might use 24 bits per pixel to represent millions of different colors, typically by storing values for Red, Green, and Blue channels. The total file size is directly related to the number of pixels and the color depth.

When to use it

Raster graphics are the standard for any image with complex color gradations, textures, and fine details. This makes them the go-to format for digital photographs, scanned artwork, and detailed digital paintings. If you're capturing reality with a camera or a scanner, you are creating a raster image.

When not to use it

The primary weakness is scaling. Because the image is a fixed grid of pixels, making it larger requires software to invent new pixels, which often results in a blurry or 'pixelated' look. For graphics that need to be resized frequently without loss of quality, like logos, fonts, or technical diagrams, vector graphics are a better choice as they use mathematical equations to define shapes.

One canonical example

A JPEG photo from your smartphone is a perfect example. It has fixed dimensions, like 4032x3024 pixels. If you zoom in far enough, you can see the individual square pixels that make up the image. If you try to print it on a large billboard, it will look blurry because the fixed number of pixels are being stretched over a huge area.

Interview question

What is the main drawback of representing a digital image as a fixed grid of pixels?

  • a.It results in a fixed file size regardless of image complexity.
  • b.It causes the image to appear blurry or pixelated when scaled up significantly.Correct
  • c.It cannot accurately capture continuous color and light variations.
  • d.It requires complex mathematical equations to define each pixel's color.
Why?

The card states that the 'primary weakness is scaling' for raster images, as making them larger requires inventing new pixels, leading to blurriness or pixelation. Option D describes vector graphics, which is a common misconception about how raster images work.

Just read this? Test yourself on what you have been reading.

Read the original → en.wikipedia.org

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on computer vision — each one lists the topics its interview covers.

See open roles