13
Computer Graphics Lesson 2 July 12, 2005

Computer Graphics Lesson 2 July 12, 2005

  • Upload
    noel

  • View
    24

  • Download
    2

Embed Size (px)

DESCRIPTION

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. - PowerPoint PPT Presentation

Citation preview

Page 1: Computer Graphics Lesson 2 July 12, 2005

Computer Graphics

Lesson 2July 12, 2005

Page 2: Computer Graphics Lesson 2 July 12, 2005

Image FormatsWhat are some formats you are familiar with?

There are 4 basic image format types:• Uncompressed• “Lossy” Compression• Palletized Images• Vector Images

Page 3: Computer Graphics Lesson 2 July 12, 2005

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.

Page 4: Computer Graphics Lesson 2 July 12, 2005

Uncompressed ImagesEach Pixel is stored using 3 numbers representing the individual color channels.

R = 243

G = 198

B = 114

R = 239

G = 190

B = 106

R = 243

G = 199

B = 115

R = 245

G = 197

B = 114

R = 245

G = 197

B = 112

R = 241

G = 192

B = 108

R = 244

G = 195

B = 109

R = 243

G = 190

B = 102

R = 239

G = 184

B = 99

… … … …

Page 5: Computer Graphics Lesson 2 July 12, 2005

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.

Page 6: Computer Graphics Lesson 2 July 12, 2005

Compressed ImagesThe 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.

With JPEG CompressionWithout Compression

Page 7: Computer Graphics Lesson 2 July 12, 2005

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.

Page 8: Computer Graphics Lesson 2 July 12, 2005

Color PalletsAnother 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.

Page 9: Computer Graphics Lesson 2 July 12, 2005

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.

Page 10: Computer Graphics Lesson 2 July 12, 2005

Color Pallets

Page 11: Computer Graphics Lesson 2 July 12, 2005

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).

Page 12: Computer Graphics Lesson 2 July 12, 2005

Vector ImagesVector 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.

Page 13: Computer Graphics Lesson 2 July 12, 2005

Image Format Comparison

BMP JPEG GIF SVG

File Size Largest Variable Small Small

Image QualityPerfect at a given

resolution.Variable

Some color depth loss.

Perfect

Scalability LimitedLimited and results in

more loss.Limited Perfect

Photorealism Best Very good Poor Bad