Imaging ‘Quick Start’ Guide
Imaging software is one of the core foundations of Accusoft. However, there can be some complex concepts and terms related to imaging that lead to bad practices or misleading expectations. This guide was created to get you up and running with some common knowledge, as well as give you some terms to research and things to keep in mind when you begin using our products.
Two Formats for Representing Image Data
There are two different ways to represent image data on a screen. These are Raster and Vector format, and each type has its advantages and disadvantages that should be understood before working with them. It is important to note that they are each independent of each other and, although you can convert from one format to another, you cannot make any assumptions about a raster image based solely upon its vector counterpart, and vice versa. With that being said, we’ll be focusing on Raster format for this post.
Raster Format
Raster, in its simplest form, is nothing more than an array of pixels organized into a grid, or matrix, where each cell contains a value representing information, with color data being the most common. These grids, along with the data within each ‘cell’ (called a pixel) come together to form the images we see on our screens. Some of the most common file types for Raster Data are JPEG, JPEG2K, Exif, TIFF, GIF, BMP, and PNG.
To get an image to display digitally, it must go through a process called sampling and quantization. Sampling takes the continuous image and breaks it into a matrix. Quantization then takes this grid and places a ‘quantity’, or numeric value, into each of the cells that represents the color to be displayed there.
The Pixel
To understand raster data, it’s fundamental to understand the pixel, similar to how biologists must understand the cell to understand whole organisms. A pixel (short for picture element) is an individual cell of a matrix that is mapped to a segment of the screen. This matrix represents our raster image, as shown below:
As you can see, the grid starts with the top-left most pixel as the origin, and the bottom right most location as (width-1, height-1) location in a zero-indexed array. Different file formats will store this data slightly differently, and usually include some metadata and header information along with the pixel data for context.
Color Depth
Now, you may be wondering, “How much data can be stored within a single pixel?” It depends upon its color-depth or bit-depth, which is measured in bpp, or bits per pixel. The common values for bit depth, and the number of colors each can represent, are listed below:
- 1bpp = 21 = 2 colors (Black and White)
- 2bpp = 22 = 4 colors
- 4bpp = 24 = 16 colors
- 8bpp = 28 = 256 colors (Grayscale OR Limited Color)
- 16bpp = 216 = 65536 colors (R/G/B Color)
- 24bpp = 224 = 16777216 colors (R/G/B Color)
…and so on!
Bits per Pixel refers to the amount of data stored within each pixel. This is generally used when referencing color data. The overwhelmingly most common are 1 (for black and white) and 24 (for color images). With 1- bit images, you’re allowed to represent two unique colors, with those two colors represented by ‘flipping the bit’ to switch between black and white. Most forms used in the business world use this bit depth. This will result in a smaller file size, but you will not be able to represent any complex color data with such a limited bpp.
To represent color, the most common format for digital images is 24 bpp, usually associated with the RGB (Red/Green/Blue) color space, also known as the Additive Color Model. This allocates 1 byte to each color (or channel) and thus allows for ~16 million unique colors. It creates all of these colors by using Red/Green/Blue and combining those colors using various ratios to create unique ones. For printed images it is common to see 32 bpp used to represent color in the form of CMYK (Cyan/Magenta/Yellow/Key (Black)). This model is subtractive, as instead of adding colors together to create it’s ~4 million unique colors, it subtracts colors from other colors. K, or black, is the subtraction of all of these colors, and is why it is used for printing. These two color models are opposites of each other, as you can see here:
Learn more about color depth, resolution, vector formats, and more in the rest of my article here.