MCIS 625: Computer Graphics
Winter 2004

WEEK 3

Instructor: Dr. Michael Laszlo


Assignment

  1. Write a short essay (about four or five paragraphs in length) about one of the following graphics file formats:
    (i) PostScript
    (ii) JPEG
    (iii) GIF
    (iv) PNG

    Choose only one of the file formats above, whichever most interests you. Your essay should address at least the following points:
    (a) Describe the compression method used by your chosen format. Very briefly summarize the format specification. Be sure to note whether the compression is lossless or lossy.
    (b) What average compression ratio does the format achieves? What is the best compression ratio it achieves? Relate compression ratio to image quality.
    (c) For what kinds of images is the format well suited? For what kinds of images is the format poorly suited?

    Please post your essay to our course forum by February 18. You may post the essay itself, or a link to your essay which you will have set up on the Web (the latter approach is preferable, especially if your essay includes images). For essay submission, I will set up four threads in our forum: PostScript File Format, JPEG File Format, GIF File Format, and PNG File Format. Please post your essay or essay link to whichever thread is appropriate.

  2. Optional reading assignment: Chapter 4 of Foley et al.


Graphics File Formats
A file format is a specification for organizing data in a file. A graphics file format is a file format concerned with representing graphics: pictures, bitmaps, graphical objects, page descriptions, and the like. There exists a dizzying array of different graphics file formats, possessing such unlikely names as JPEG, GIF, PNG, TIFF, BMP, PICT, and PostScript. To get a handle on these many formats, two classification schemes prove useful: (1) raster vs. vector formats, and (2) lossless vs. lossy compression.

Raster formats and vector formats
The first classification scheme concerns the type of format. Two kinds of file formats exist for graphics: vector and raster. Raster formats describe shapes as patterns of dots (pixels). A realistic image (such as a photograph) is best described as a raster. Vector formats describe shapes using mathematics. For example, the typical vector description of a line segment specifies its two endpoints as coordinates (x1,y1) and (x2,y2); and a circle by its centerpoint (x,y) and radius r. In contrast, a raster representation of the line is achieved by painting the pixels that make up the line with some color that contrasts with the background color; and of the same circle by painting those pixels that make up the circle's circumference.

Graphics described by a vector format are easily converted to raster format—simply draw the graphic objects into a bitmap. It is also possible to embed a raster graphic (or image) in a vector file. It is difficult (though possible) to convert a raster graphic into a vector format. The integrity of objects is lost in a raster graphic (e.g., in raster form, a line is a collection of pixels, not a mathematical object).

Vector formats scale better than raster formats. To display a vector image at varying resolutions (e.g., for printing, for screen display), the given resolution is used in mapping the mathematical description to the display. In contrast, raster formats are given in a fixed resolution. If the display is at some different resolution, the image must be scaled to the display's resolution, which generally results in loss of detail.

Compression
The second classification scheme for understanding graphics file formats concerns compression. Compression saves both space and time. An image of size 1000 pixel×1000 pixel ×24 bit deep requires about 3 MB of storage and 7 minutes for transmission over a 64 Kbit/second ISDN line. If the image is compressed at a 10:1 ratio, the storage requirement is reduced to 300 KB and the transmission time to under 40 seconds.

There exist two types of compression: lossless and lossy. When lossless compression is applied to a file, no information is lost. When the file is uncompressed, it is restored to its original form—the uncompressed file and the original file are identical. Lossless compression techniques look for areas containing pixels of the same value, and represents these areas more compactly.

Lossy compression loses information. When a lossy compressed file is uncompressed, the resulting file is similar to, but not identical to, the original file. Nonetheless, there is little or no degradation of the uncompressed image. This is because the original image contained a finer gradation of colors than the human eye is capable of distinguishing. Lossy compression employs a more coarse gradation of colors which implies little loss of visual information. Note that lossy compression techniques have greater latitude in changing color levels than in changing brightness levels because human vision is more sensitive to changes in brightness than to changes of hue. The JPEG file format uses lossy compression.

Some common graphics file formats
GIF

The Graphics Interchange Format (GIF) was developed by CompuServe for the exchange of graphics. Stores up to 8-bit images in raster format, and uses lossless compression (the LZW algorithm) to achieve compression ratios on the order of 2:1 (at best, 5:1 can be achieved). Pixels are stored sequentially. A GIF file can contain multiple images. GIF works best on images containing few distinct colors and straight, sharp edges.

JPEG
JPEG stands for Joint Photographic Experts Group, which wrote the standard. The format stores up to 24-bit images in raster format using lossy compression. It generally achieves compression ratios of 10:1, and can sometimes achieve on the order of 35:1. On compression, the user can choose settings that determine how the file size vs. image quality tradeoff is resolved. On uncompression, settings can be used to tradeoff the speed of decoding versus image quality. JPEG works best on photographic and photorealistic images, and images of high complexity. The lossy compression results in little image degradation by exploiting the fact that human vision is less sensitive to small changes in color than to small changes in brightness.

PostScript
PostScript is a page-and-screen description language developed and supported by Adobe Systems. To obtain an image described by a PostScript program, a PostScript interpreter executes the program commands to paint characters, graphical shapes, images, and so forth. PostScript is a postfix language. To interpret a PostScript program, the program is scanned from left-to-right. Operands are pushed onto a stack. When an n-ary operator (an operator taking n arguments) is encountered, the topmost n operands are popped from the stack and the operator is applied to them. If there are results, the results are pushed onto the stack. (If there is no result, the operation is performed for its side-effect only.)

PNG
The Portable Network Graphics format was designed to replace GIF, over which it boasts three key advantages. First, PNG provides an alpha channel, which supports variable degrees of transparency. Second, it supports gamma correction for control of image brightness. Third, PNG supports 2-dimensional interlacing, a form of progressive image display.

More on graphics file formats
More information is available on the Graphics File Formats Page. In addition, the following books are quite good:


[ Home | Course | Syllabus ]