MCIS 625: Computer Graphics
Winter 2004
WEEK 3
Instructor: Dr. Michael Laszlo
Assignment
Optional reading assignment: Chapter 4 of Foley et al.
Graphics described by a vector format are easily converted to raster formatsimply 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 formthe 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: