From "Code"
🎧 Listen to Summary
Free 10-min PreviewDigital Media Formats and Compression
Key Insight
Digital visual information is primarily represented in two forms: vector and raster graphics. Vector graphics algorithmically create images using mathematical descriptions of lines, curves, and filled areas, making them ideal for Computer-Assisted Drawing (CAD) in fields like engineering and architecture. These images are typically stored in metafiles as collections of drawing commands. Raster graphics, also known as bitmaps, encode images as rectangular arrays of pixels, defined by their spatial resolution (width and height in pixels) and color depth (the number of bits associated with each pixel). Bitmaps are essential for representing complex, real-world images such as photographs, which are too intricate for efficient vector representation.
Real-world images are converted into digital bitmaps using various devices employing Charge-Coupled Devices (CCDs) to capture light and generate pixel data. Scanners use CCD rows to sweep across printed images, while video camcorders and digital cameras utilize two-dimensional CCD arrays. These devices produce bitmaps stored in file formats like Macintosh Paint/PICT or Windows BMP. Text-based files, while effective for simple ASCII text and searchable, proved inadequate for richly formatted text or embedding images. Solutions like Rich Text Format (RTF) emerged, embedding formatting commands using escape characters to indicate font specifications and paragraph layout. PostScript, a general-purpose graphics programming language, extended this concept to describe complex text and graphics for high-end printers. Optical Character Recognition (OCR) attempts to convert text within bitmaps (e.g., from faxes or scanned pages) into ASCII character codes, though it is often less than 100% accurate, with handwriting recognition being even more challenging.
The considerable size of bitmap images and video files necessitates data compression techniques. Run-Length Encoding (RLE) reduces file size by encoding sequences of identical pixels, for instance, representing 72 consecutive blue pixels as a count rather than individual pixel data. LZW compression, used in GIF files (developed by CompuServe in 1987), is a more advanced lossless technique that detects and encodes patterns of differently valued pixels. Both RLE and LZW are lossless, meaning the original data can be perfectly reconstructed. Lossy compression, exemplified by JPEG for still images and MPEG for video, discards less perceptually significant data based on psychovisual research to achieve much higher compression ratios. For instance, a 2-hour movie at 640x480 resolution with 24-bit color, uncompressed, would be approximately 200 gigabytes; MPEG compression can reduce this to about 4 gigabytes for DVD storage, a compression factor of about 50.
📚 Continue Your Learning Journey — No Payment Required
Access the complete Code summary with audio narration, key takeaways, and actionable insights from Charles Petzold.