Last Modified: 1/29/08
  Computer Training
Graphics File Formats and Graphic File Conversion

Credit: Kirk Born (St Sci/NASA)

Graphic File Types

The most popular Web graphic file types are GIF and JPEG, for static images, and animated GIF, Java Applets, MPEG, and Quick-Time, for animations. Another graphic format, PNG has been widely discussed but is just now becoming significant. It is supported in many Microsoft products, such as Image Composer, MicroSoft WORD, and Internet Explorer.

Graphics File Sizes

Uncompressed pixel format files are always NxMxB bytes in size, regardless of the complexity of the image, where N and M are the number of rows and columns, and B is the number of bytes per pixel. For a 1024x768 image we get about 800 Kbytes for 1 byte/pixel and ~2.4 Mbytes for 3 bytes/pixel (16.7 million colors). At a 33K baud transfer rate (which is what most 56K modems actually give) we have ~ 3K bytes/sec, or 270 seconds to load 256 color image and 800 seconds, more than 13 minutes, to load a single full color image -- much too long! For animation, at 30 frames/sec, it would take 5 hours to load one seconds worth of animation, or more than 2 years to load/display a one hour movie!

Image Compression

This is an absolute must for Web graphics. Types include:
  • LZW (Lempil-Ziv-Welch): it builds its codes to represent patterns based on the patterns it actually finds in the data, so the data strings are replaced by the short codes, and so the file is compressed. Excellent for logos and comics but not so good for photographs: can get compressions of 10-30 to 1. GIF files use LZW. It is especially effective when the compression scheme is adaptive; that is, it looks at the frequency of colors in the original image and then picks the best 256 colors to match the original.

  • Run-length-encoding (RLE): replaces runs of identical bytes with a byte-count and the color, e.g.,
     RRRRRRRGGGGGGBRGGGGGG    is replaced by
     7R6G1B1R6G                         
                
  • JPEG (Joint Photographic Experts group): main compression is done by applying a Cosine Transform to each 8x8 block of pixels. This generates a color frequency map. The 1st element in the map is the average color, and the other elements represent less important details. By throwing away those details in the frequency map which are barely detectable by the human eye, the data is compressed. Compression ratios of 15:1 are common. JPEG is especially well suited to 24 bit photorealistic images.

    However, there will soon be a new JPEG format, named JPEG 2000, that uses some version of the wavelet format discussed below, and which offers excellent compression at values of 100-to-1 or more. See JPEG 2000 and Homesite of the JEG committee for more information.

  • Wavelet compression per se is discussed and demonstrated in these links: Image Understanding Lab and a comparison of JPEG and Wavelet compression.

  • MPEG (Moving Picture Experts Group): represents a set of frames:
     FFFFFFFFFFFFFFFFFFF    by runs of the form:
     IBBPBBPBBPBBPBBPBBP
                
    where I = the first "F" and the B's and P's represent just the "deltas" or differences between the images (the P is the difference between the current frame and previous, whereas the B is the bi-directional differences between previous-current-next frame). Since each P or B represents just the differences between very similar frames, rather than all the pixels in each frame, they are much smaller than the corresponding F frames. The frames are encoded in a different sequence than when it is displayed. Then the entire subset of encoded frames are subject to JPEG encoding. Compression ratios of 30:1 are common.

Color Schemes

These include RGB (Red-Green-Blue) for most displays, CYMK (Cyan-Yellow-Magenta-blacK) for hardcopy, and LAB for the truest possible colors. In terms of color fidelity, CYMK < RGB < LAB (approximately), but the differences are not large in terms of quality. We will stick to RGB.

Color tables:

           Index   Red    Green    Blue
              0     10      177      67
              1     15      202      72
              2     17      225      101
            ...     ...     ...      ...
            255    255       23      199  
          

Graphic File Conversion

Obviously there are many types of graphic files and not all of them can be used on the Web, so what do you do if you encounter a graphic file that is not in a compatible format? You convert it to the format that you desire. Most graphic systems, such as PhotoShop, XV, PaintShop Pro, and many others allow you to convert graphic files to other formats just by reading in a file in one format and saving it in another. For example, PaintShop Pro lets you read in and save files in .bmp, .fpx, .gif, .jpg, .mix, .png, .psd, .tga, and .tif and many other formats.
Previous Home Next

Course Topics

Graphics Design Based on Edward Tufte's Principles

Setting up your First Web Page

Acquiring Graphics From the Web Itself

Acquiring Graphics from Scanners and Digital Cameras

Graphics File Formats and Graphic File Conversion

Efficient Graphics

Colors, Backgrounds, Transparencies

Creating and Modifying Graphics Using Software

How to Do It

 
Previous Home Next

Other Topics:   Graphics Concepts   |   More Graphics Concepts   |   And still More Concepts   

©1999 UW Technology