User Tools

Site Tools


cs276:dhl.tutprog3

<Tutorial Program 3>

Due Date: 09/24/2009

Part I

     The JPEG (“Joint Photographic Experts Group”) method of image compression is applied to create the JPEG/Exif and less commonly used JPEG/JFIF file formats. There are both advantages and disadvantages to using the JPEG file format. One major drawback is its lossy nature: every time the file is compressed, information in the image is lost (e.g. the color of pixels can be changed). This makes JPEG files unsuitable for scenarios in which a file is frequently modified and saved, and compressed: at the end of a long series of operations performed on the file, the resulting quality would likely be relatively very low. Conversely, one advantage of using JPEG is its relatively small file size (as a result of compression). This aspect makes the format suitable for images intended for export and distribution (e.g. hosted on the Internet, or packaged with a computer program).
     JPEG does not support transparency via an alpha channel (a layer containing information about whether there is any blending between overlapping pixels); instead of 4, there are only 3 channels: red, green, and blue (RGB- with each channel given 1 byte of storage per pixel). Using just these 3 color channels, a JPEG file can display 28 x 28 x 28 = 256 x 256 x 256 = 16,777,216 different colors.

     The GIF (“Graphics Interchange Format”) image file format is lossless. This is because it implements the Lempel-Ziv-Welch (LZW) compression algorithm, in order to decrease file size at no detriment to image quality. The GIF format allows up to 28 = 256 colors (in RGB-A: red, green, blue, plus transparency). Each pixel is allocated (up to) 1 byte of storage.

     TGA (“Truevision Graphics Adapter”, or more fully, TARGA- “Truevision Advanced Raster Graphics Adapter”) is an image file format. It is lossy only in certain situations, such as when compressing images with many variations in color. In dealing with simpler images, such as plain textures, TGA's lossy nature is not a problem. There is even an optional compression method that employs a lossless algorithm: run-length encoding (RLE).
     TGA can display 28 x 28 x 28 = 256 x 256 x 256 = 16,777,216 colors (in RGB-A). Each pixel is allocated up to 4 bytes of color storage (1 for each component: red, green, blue, and transparency).

     PNG (“Portable Network Graphics”) file format is lossless; the quality of an image file does not deteriorate as more and more operations are performed on it. It has a wide variety of options for displaying RGB colors on a screen or other medium: indexed (up to 1 byte per pixel), greyscale without alpha channel, with alpha channel, truecolor, and truecolor with alpha channel (each up to 2 bytes per pixel). The PNG format supports the display of 28 x 28 x 28 = 256 x 256 x 256 = 16,777,216 possible colors, as well as an alpha channel for transparency.

Part II

a)

b)

c)

</Tutorial Program 3>

cs276/dhl.tutprog3.txt · Last modified: 2009/09/24 11:54 by wikiwikwik