Chapter 1 Colors, Depth, Space (and Time?)
Section 1.1 Image File Formats
Subsection 1.1.1 Vector Formats
Vector formats represent images as a series of drawing instructions. Becuase of this, they are infinitely scalable. This is well suited for iamges that can be defined geometrically, but not as well for real-world images. Common file type: SVG (Scalable Vector Graphics).
Subsection 1.1.2 Raster Formats
Raster formats represent images as a grid of color values (pixels).
Raster images can be uncompressed or compressed.
Uncompressed formats contain color data for each pixel. These files are quite large. Common file types: BMP, TIFF, RAW
Compressed formats use a compression algorithm to minimize file size. Some of these algorithms are lossless, while others are lossy.
Lossless compression algorithms contain enough information to exactly recreate the original image. Common file types: PNG (Portable Network Graphics), GIF (Graphics Interchange Format)
Lossy compression algorithms do not retain all the details of the original image. Common file type: JPEG (Joint Photographic Experts Group).
Subsection 1.1.3 NetPBM File Formats
In this class we will be using the PPM (Portable PixMap) format specifically. PPM files prespresent pixel data as RGB (Red, Green, Blue) triplets in either ASCII or binary. In ASCII based PPMs, all whitespace is equivalent. Here is a sample ASCII PPM file:
P3 4 3 255 255 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 255 0 0 255
The first three lines make up the file header:
P3
: Type of PPM, 3-btye RGB, in ASCII (P6
is RGB in binary).4 3
: Width x Height, in pixels.255
: Maximum value per color (will scale to 255 if not 255)