130 likes | 207 Views
Computer Graphics Lesson 2 July 12, 2005. Image Formats. What are some formats you are familiar with?. There are 4 basic image format types: Uncompressed “Lossy” Compression Palletized Images Vector Images. Uncompressed Images.
E N D
Computer Graphics Lesson 2 July 12, 2005
Image Formats What are some formats you are familiar with? • There are 4 basic image format types: • Uncompressed • “Lossy” Compression • Palletized Images • Vector Images
Uncompressed Images An image is considered to be uncompressed if each pixel is stored individually with its full color value. The Bitmap (BMP) file format is a good example of an uncompressed file format. BMP files may still be compressed using “lossless” compression algorithms such as ZIP.
Uncompressed Images Each Pixel is stored using 3 numbers representing the individual color channels.
Uncompressed Images Calculating Size: An uncompressed image requires 3 bytes (numbers) per pixel; one for each color channel. So… a 256x256 image would require 256*256*3 = 196608 bytes! OMG! … or 192 kilobytes… meh.
Compressed Images The Joint Photographic Experts Group (JPEG) file format utilizes image compression by approximation to reduce file size. As you can see, there is some quality loss although the effect is magnified here. Without Compression With JPEG Compression
Compressed Images Compressed Images take advantage of visual approximation. Most images do not need to be displayed exactly as they were created. The resulting image need only resemble the original. The compression comes at the expense of some image quality. So, as is often the case in CS we have a memory quality tradeoff.
Color Pallets Another way of making images smaller is by restricting the number of colors that can be displayed in one image. Previously we discussed 1 byte (8bits) per color channel. This is known as 24-bit color or True Color. 28 * 28 * 28 = 16,777,216 colors While this provides good color depth, in many images less than a handful of those colors are actually used.
Color Pallets To the right is a 256 color table containing every color used in this Mona Lisa image. Each color is 24 bits, but every pixel contains only 8 bits which index a color in the table.
Vector Images In a vector image, the computer stores lines, shapes, and colors instead of pixels. When it is time to show the image a traditional “raster” image is generated for display on a monitor. The most popular file format for vectors is called Scalable Vector Graphics (SVG).
Vector Images Vector images look more like drawings, but they have the advantage that that can be rastered at any level of detail, meaning they are infinitely scalable.