Core Concepts of Raster Graphics
Understand raster graphics fundamentals, their data model and resolution dependence, and key compression techniques.
Summary
Read Summary
Flashcards
Save Flashcards
Quiz
Take Quiz
Quick Practice
What is the basic composition of a raster graphic?
1 of 9
Summary
Understanding Raster Graphics
Introduction
A raster graphic (also called a bitmap) is a digital image stored as a rectangular grid of tiny colored squares called pixels. Think of it like a mosaic made of colored tiles—zoom in close enough and you'll see individual squares of solid color, each contributing to the overall image. This is fundamentally different from how vector graphics work, and this difference has important implications for how rasters can be used and manipulated.
What Is a Raster Graphic?
A raster image is simply a large array of pixels, where each pixel stores color information. The image you're looking at on your screen right now is a raster image—composed of millions of colored dots arranged in rows and columns.
The key insight here is that rasters store actual color values for each pixel location. If you have a red pixel, the image literally records "this pixel is red" for that position. This is different from vector graphics, which store mathematical descriptions like "draw a circle from point A to point B."
Rasters vs. Vector Graphics
Understanding the fundamental difference between raster and vector graphics is crucial because it explains almost all the strengths and weaknesses of rasters.
Vector graphics describe images using mathematical formulas that define shapes, lines, and curves. A circle in a vector graphic is stored as "circle with center at (100, 100) and radius 50" rather than as individual pixels.
Raster graphics, by contrast, store the exact color of each pixel in the grid. There's no formula—just raw color data for thousands or millions of pixels.
Why does this matter? This difference is why rasters can beautifully capture photographs and complex artwork with subtle color variations, while vectors are better for logos and diagrams that need crisp, scalable edges.
Dimensions, Resolution, and Color Depth
Raster images are defined by three key properties:
Width and height (in pixels): A typical photo might be 1920 × 1080 pixels, meaning 1920 pixels wide and 1080 pixels tall, for a total of about 2 million pixels.
Color depth: This measures how many bits of data are used to store the color of each pixel. Higher color depth means more possible colors. A 1-bit image can only show black or white. An 8-bit image can show 256 different colors. A 24-bit image (the modern standard) can show over 16 million colors.
Resolution (pixel size): All pixels in a raster image are the same size. The resolution refers to both how many pixels there are and their physical size when printed. Higher resolution means smaller, more numerous pixels, which generally means sharper images.
The Raster Data Model
The raster data model is remarkably simple: it divides a two-dimensional plane into a regular rectangular grid of cells. Each cell is one pixel.
This uniformity is both a strength and a limitation. The strength is simplicity—it's trivial to find any pixel (just use its row and column coordinates). The limitation is that uniform grids can be inefficient for images with large areas of solid color, and they can create jagged edges on curved shapes.
Pixel Formats
Pixels can be stored in different formats depending on what kind of image you're creating:
Binary: 1 bit per pixel (black or white only)
Grayscale: Multiple bits per pixel to represent shades of gray
Palettized: Uses a color lookup table; each pixel stores an index into the palette
Full-color (RGB): Each pixel stores separate values for red, green, and blue channels
The 24-Bit Standard
The modern standard for full-color raster images is 24 bits per pixel: 8 bits each for red, green, and blue (RGB). Each 8-bit channel can store values from 0 to 255.
This means:
Red channel: 0–255 (where 0 is no red, 255 is full red)
Green channel: 0–255
Blue channel: 0–255
The combination of three 8-bit channels gives you $2^{24}$ or 16,777,216 possible colors, which is more than the human eye can distinguish. This is why 24-bit RGB became the standard for digital photography and most image applications.
Important concept: Be careful not to confuse color depth (how many bits per pixel) with color space (the range of colors that can be represented). Both matter, but they're different. A 24-bit image in RGB color space can represent millions of colors within the RGB range.
Resolution Dependence: A Critical Limitation
Here's one of the most important characteristics of raster graphics: they are resolution dependent.
This means the quality of a raster image is locked to its resolution. If you take a 100 × 100 pixel image and enlarge it to twice that size, the computer must guess what colors should fill the new pixels. The result is blurry or pixelated—you've literally seen this happen when a small image gets stretched on a screen.
More precisely, when you scale up a raster image, you're either:
Stretching pixels (each pixel becomes a larger square) → pixelation
Interpolating (guessing new pixel colors) → blurriness
Compare this to vector graphics, which are defined by mathematical formulas. A circle defined as "radius 50" looks crisp whether you display it at 100 pixels or 1000 pixels—the formula automatically generates the right edges at any size.
This is why raster graphics work great for photographs (you can't usually improve a photo by enlarging it anyway) but poorly for logos and text (which need to look sharp at any size).
Common File Formats
<extrainfo>
Several standard raster file formats are commonly used:
GIF (Graphics Interchange Format): Supports 256 colors and animation; uses lossless compression
JPEG (Joint Photographic Experts Group): Widely used for photographs; employs lossy compression for smaller file sizes
PNG (Portable Network Graphics): Supports full color with transparency; uses lossless compression; designed as a replacement for GIF
BMP (Bitmap): Simple uncompressed format; rarely used today due to large file sizes
Understanding which format to use depends on your needs, but these details are less critical than understanding the compression techniques behind them.
</extrainfo>
Compression: Essential for Practical Use
Why do we need compression at all? A high-resolution raster image contains thousands or millions of pixels, and storing the color value for each one creates huge file sizes. A single uncompressed photograph might be 50+ megabytes. Compression reduces this dramatically.
There are two fundamentally different approaches:
Lossless Compression
Lossless compression allows the original pixel values to be perfectly reconstructed—no information is lost. Two common methods:
Run-length encoding (RLE): If you have 50 consecutive red pixels, instead of storing 50 separate red values, store "50 × red." This works great for images with large areas of solid color but poorly for complex photographs with endless color variation.
Lempel–Ziv–Welch (LZW) compression: Replaces repeated sequences of pixels with shorter codes. As the file is read, the algorithm builds a dictionary of common patterns and uses codes to reference them.
Lossless compression is essential when you cannot afford to lose any information—medical images, legal documents, and archival photographs typically use lossless compression.
Lossy Compression
Lossy compression achieves much greater compression by discarding some information. The original pixel values cannot be perfectly recovered, but the human eye may not notice the difference.
JPEG compression is the most famous example. JPEG works by:
Converting the image to a color space that separates brightness from color information
Removing detail from the color channels (humans notice brightness changes more than color changes)
Quantizing colors—replacing slight color variations with the same value
The result? A 5MB uncompressed photograph might compress to 500KB as a JPEG. The trade-off is that quality is permanently lost—if you zoom in very close, you'll see "artifacts" (blocky distortions) where compression removed detail.
Key distinction: Use lossy compression for photographs and images where small quality loss is acceptable. Use lossless compression when you need to preserve every pixel exactly—or when the image has large areas of uniform color where lossless compression actually works efficiently.
Summary: Raster graphics are the standard for photographs and complex artwork because they can represent subtle color variations beautifully. However, they're limited by resolution dependence (you can't enlarge them without quality loss) and storage requirements (compression is essential for practical use). Understanding when rasters are appropriate versus when to use vector graphics is crucial for working with digital images effectively.
Flashcards
What is the basic composition of a raster graphic?
A digital image composed of a rectangular grid of tiny colored squares called pixels.
How do raster graphics differ from vector graphics in terms of how they store image data?
Vector graphics use mathematical formulas for shapes and lines, while raster graphics store the exact color of each individual pixel.
What two primary properties define the specifications of a raster image?
Dimensions (width and height in pixels)
Color depth (number of bits used per pixel)
What are the common types of pixel formats used to store raster data?
Binary
Grayscale
Palettized
Full-color
What is the functional difference between color depth and color space in raster graphics?
Color depth determines the number of distinct colors represented, while color space defines the range (gamut) of colors covered.
How are bits typically allocated in a standard 24-bit color raster format?
8 bits ($2^8 = 256$ values) are allocated to each of the Red, Green, and Blue (RGB) channels.
Why does scaling a raster graphic to a higher resolution typically result in a loss of apparent quality?
Because raster graphics are resolution dependent, unlike vector graphics which use mathematical formulas to maintain crisp edges at any size.
What is the primary characteristic of lossless compression methods like Run-Length Encoding (RLE) or LZW?
They allow the original pixel values to be perfectly reconstructed without any data loss.
How does lossy compression, such as JPEG, handle pixel data during storage?
It stores an approximation of the original pixel values, meaning the exact original data cannot be fully recovered.
Quiz
Core Concepts of Raster Graphics Quiz Question 1: How do raster graphics differ from vector graphics in the way color information is stored?
- Raster graphics store the exact color of each pixel. (correct)
- Vector graphics store the exact color of each pixel.
- Raster graphics store shapes using mathematical formulas.
- Vector graphics store only outlines without color.
Core Concepts of Raster Graphics Quiz Question 2: In raster images, what does “color depth” refer to?
- The number of bits used for each pixel. (correct)
- The width of the image in pixels.
- The height of the image in pixels.
- The resolution measured in dots per inch.
Core Concepts of Raster Graphics Quiz Question 3: What aspect of a raster image determines how many distinct colors can be represented?
- Color depth (correct)
- Color space
- Resolution
- Compression method
Core Concepts of Raster Graphics Quiz Question 4: In a typical 24‑bit color raster format, how many bits are allocated to each of the red, green, and blue channels?
- 8 bits (correct)
- 4 bits
- 16 bits
- 2 bits
Core Concepts of Raster Graphics Quiz Question 5: What is a key limitation of raster graphics when they are enlarged beyond their original resolution?
- Loss of apparent quality (correct)
- Increase in file size only
- Change in color depth
- Ability to maintain crisp edges
Core Concepts of Raster Graphics Quiz Question 6: Why can vector graphics be enlarged to any size without losing edge sharpness?
- Because they are defined by mathematical formulas. (correct)
- Because they use higher‑resolution bitmaps.
- Because they store multiple resolutions internally.
- Because they compress data losslessly.
Core Concepts of Raster Graphics Quiz Question 7: Why is compression necessary for high‑resolution raster images?
- To reduce storage size. (correct)
- To increase color depth.
- To improve resolution.
- To change the file format.
Core Concepts of Raster Graphics Quiz Question 8: Which of the following is an example of a lossless compression method used for raster images?
- Run‑length encoding (correct)
- Joint Photographic Experts Group (JPEG) compression
- MPEG video compression
- MP3 audio compression
Core Concepts of Raster Graphics Quiz Question 9: Which of the following is a widely used raster image file format?
- Portable Network Graphics (PNG) (correct)
- Scalable Vector Graphics (SVG)
- Adobe Illustrator (AI)
- Microsoft Excel Spreadsheet (XLSX)
Core Concepts of Raster Graphics Quiz Question 10: Which of the following statements is true about raster graphics?
- They are composed of a rectangular grid of pixels. (correct)
- They can be enlarged to any size without loss of detail.
- They store image data as mathematical equations.
- They represent three‑dimensional volumetric data.
Core Concepts of Raster Graphics Quiz Question 11: Which of the following is NOT a common pixel format used in raster images?
- Vector (correct)
- Binary
- Grayscale
- Palettized
Core Concepts of Raster Graphics Quiz Question 12: Which description matches how the raster data model represents the layout of an image?
- It uses a regular grid of equal‑sized square cells (pixels). (correct)
- It stores image data as a collection of mathematical curves.
- It divides the image into hexagonal tiles.
- It represents the image as a list of color‑palette entries only.
Core Concepts of Raster Graphics Quiz Question 13: In raster graphics, what does the term “resolution” (also called support) refer to?
- The uniform size of each pixel across the image (correct)
- The total number of pixels in the image
- The number of bits used to represent each pixel’s color
- The degree of compression applied to the image file
How do raster graphics differ from vector graphics in the way color information is stored?
1 of 13
Key Concepts
Graphics Types
Raster graphics
Vector graphics
Image Properties
Pixel
Color depth
Resolution
Color space
Image Formats and Compression
Image file format
Lossless compression
Lossy compression
Raster data model
Definitions
Raster graphics
Digital images composed of a rectangular grid of colored pixels.
Vector graphics
Images defined by mathematical formulas that describe shapes and lines.
Pixel
The smallest addressable element in a raster image, representing a single color value.
Color depth
The number of bits used to represent the color of each pixel in an image.
Resolution
The constant pixel size of a raster image, often expressed as pixels per inch or per unit length.
Color space
A defined range of colors that can be represented in an image, such as sRGB or Adobe RGB.
Image file format
Standardized file types for storing raster images, including GIF, JPEG, and PNG.
Lossless compression
Data compression methods that allow the original image to be perfectly reconstructed.
Lossy compression
Compression techniques that discard some image data, resulting in an approximate reconstruction.
Raster data model
The representation of a two‑dimensional plane as a regular array of cells or pixels.