Raster Images

What is a Raster Anyways?

A raster is a way of storing images in a digital format. In the most simplest terms, it is coloring squares on a grid. Generally the squares(though occasionally rectangles) are called pixels.

RGB

Every possible color the human eye can see can be represented as a combination of three primary colors: red, green, and blue. Since a computer can't actually understand the concept of a color we have to give it some hard data. so we represent each of the three colors as a number and their combination makes all of the other colors we see. This is mostly commonly known as the RGB system, and it usually consists of one byte of data, or the numbers 0 through 255, per color for a total of 3 bytes per pixel. Since we have limited combinations of colors, 256^3, this system limits us to around 16 million different colors.

Indexed or Palleted

Some image formats forgo the entire color spectrum in favor of a smaller subset of colors actually used in an image. Generally this format uses 1 byte or 256 colors, each chosen as a representative of a subset of the true colors in an image. The advantage of this format is substantial reduction of image size, but can also result in a substantial loss of quality.

Compression

While for small pictures, storing the image uncompressed might be ok but is usually pointless, it can quickly devour your hard drive when working with larger sizes. Lets see how many images we can store uncompressed on a two gigabyte flash drive:

Images Space Source Compression
23563 89Kb MichiganView with 4000m pixel none
6260 335Kb MichiganView with 2000m pixel none
3495 600kb MichiganView with 250m pixel JPEG
1484 1.38Mb MichiganView with 1000m pixel none
890 2.3MB A screenshot of a standard monitor at a resolution of 1024*768 none
204 10Mb MichiganView with 250m pixel TIF:LZW
92 22.2Mb MichiganView with 250m pixel none
89 23MB An 8 megapixel photo from a digital camera none
14 138.9Mb MichiganView with 100m pixel none
0.147 13.56Gb MichiganView with 10m pixel none
0.0014 1.32Tb MichiganView with 1m pixel none

It should be obvious that compression allows us to store either more pictures or a larger area in a much smaller space, but whats the catch? Depending on the type of compression you are using, the cost is image quality:

Image Dimensions Space Bytes/Pixel
MichiganView .jpg 2106*2250 1Mb 0.22
MichiganView .tiff 2750*2250 10Mb 1.69

If you zoom in on the JPEG, you will start to notice blocky splotches, called artifacts. (You can see this clearly near Garden Island, West of the bridge) On the TIF, it just gets blurry (or pixelated depending on your image viewer).

Lossy Compression

Lossy compression means that data is lost when the image is compressed, there is no way to revert from a compressed image back to the original. This also means that every time you compress an image while working on it, you lose a bit more data, over time this could destroy your image. JPEG is a lossy compression.

Lossless Compression

Lossless compression takes advantage of repetition in an image. In essence, it is a way store the same data more efficiently. TIF format uses a compression called LZW that is lossless. The 250m TIF above is 17Mb using an uncompressed format, or a savings of 7Mb without loss of image quality. However, compression ratio's vary widely image to image and may not always cut the image down enough for it to be manageable.

Formats

So far we've mentioned JPEG and TIF, but these two are only a small fraction of the formats out there. GDAL alone natively supports 76 formats and with the help of other libraries can support even more. Luckily, most images are in a handful of commonly used formats:

Format Compression Type Compression Ratio Notes
BMP none none raw image
GIF lossless image dependent Supports transparency, offers compression over BMP
JPEG lossy user variable Best for photo-like images when size is more important than quality
PNG lossless image dependent Successor of the GIF format, supports transparency
TIF lossless image dependent Container Format that allows storage of other data with the image

For a far more in-depth overview of common format types click Here

Raster Data Loss

A brief look at how certain image operations do not preserve data.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.