Department of Engineering

IT Services

Some Common Graphics File Formats

Introduction

There are 100s of graphics file formats around. This page discusses some of the formats most commonly used on the Web and for scanning.

Issues

  • Bitmap/Vector - There are 2 main approaches to storing images. Bitmap files are produced by scanning the image and storing the result. Such files are big but are easy for printers to deal with. This also make the file hard to re-edit easily. For example if you draw a diagonal line across a window, save the image in a bitmap format then reload it in, the image may initially look the same as before but now it's just a series of dots. In contrast, a vector format would just store the coordinates of the endpoints plus information about the line's colour, thickness, etc. When the file's reloaded, the line can still be treated as a single entity. See Bitmap versus vector graphics for illustrations.
  • File size - some formats are very efficient at storing certain types of images, and use compression algorithms.
  • Power - some formats lack the ability to store certain features (especially regarding colour)
  • Complexity - some formats require powerful software.
  • Licensing - some formats may be owned by companies who restrict their use.
  • Support - some formats (especially proprietory ones) may only be supported by a few programs.

Formats

Postscript

Postscript was invented decades ago by Adobe. It's a powerful format - indeed it's really a language: it has loops, etc, and commands to do masking, distortion, etc. It has vector and bitmap commands. Because of its power a complicated program (a "postscript interpreter") is needed to understand the files, and lots of memory may be required. This is why postscript printers are relatively expensive.

Postscript has evolved over the years: first to "Level II" and now to "Adobe® PostScript® 3™". Encapsulated Postscript (EPS) is a slight variation on Postscript. EPS files are designed to be embedded in another document rather than printed out directly.

Programs exist to display PostScript files onscreen, but they're rather complex. Though you can embed EPS in Word documents, Word can't show you what's in the EPS file unless it has an included preview image - a simplified image used for screen display only. Preview images can be in many formats too - TIFF and WMF (Windows Metaformat) being common.

PDF

Adobe developed PDF (Portable Document Format) to overcome some of the practical restrictions of Postscript. Though it's based on Postscript, PDF files are easier for programs to understand. The free viewer (called Acrobat Reader) is available for just about all computers. PDF (unlike Postscript) was designed to make the most of files viewed online.

As well as being able to hold complete documents, PDF files can contain images that can be loaded into bigger documents.

Because of the availabilty of the Viewer and the quality plus reliability of the printed output, PDF has taken over from Postscript as the format for document transfer. PDF files are common on the WWW.

JPEG

Photographs can take up a great deal of memory. The "Joint Photographic Experts Group" developed a format (officially JFIF, but usually it's called JPEG) specially designed to deal with this issue. JPEG is a "lossy" format - you can choose to sacrifice some accuracy in order to reduce file sizes. Because of the design of the format the loss of accuracy often goes unnoticed by the human eye even when space saving is considerable. See the online jpeg examples.

JPEG is well supported (even Postscript 2 interpreters understand it), and is common on the WWW but beware of using it for graphs - the fuzziness is quickly noticed.

GIF

The GIF format was common on the WWW in the early days. It's good with images that have large areas of solid colour - cartoons, icons, etc. Since then the originators have decided to invoke their patent rights, making the format increasingly unpopular.

PNG

PNG (Portable Network Graphics) is a free format that's taking over from GIF because it's free - and better too. Like GIF it supports transparency. Some old browsers can't display PNG, though Word can now load PNG files. PNG-8 is rather like gif. PNG-24 supports more colors.

TIFF

Tagged Image File Format - a bitmapped format often used for scanned images. TIFF files can be placed in all the major Word Processing packages, and most graphics editing packages accept TIFF files too. There are many variations (several compression options, alpha channels, image pyramid, etc), which can cause problems when reloading.

PICT

A file format that can contain both bitmap and vector data. It's mainly used on Macintosh computers.

Guidelines

  • For online documentation use HTML, but if the document needs to look the same wherever it's viewed or printed, use PDF (not PS or Word)
  • For WWW graphics use JPEG (for photographs) or PNG
  • For latex use EPS (JPEG can easily be converted into a similarly-sized EPS file)
  • For pdflatex use JPEG (for photographs), PDF (for scanned diagrams), or PNG
  • For scanned diagrams use TIFF or EPS
  • For scanned photographs use JPEG
Note that currently
  • xfig saves/loads EPS, GIF, JPEG, PNG, TIFF, and can save as PDF.
  • Word loads EPS, GIF, JPEG, PNG, TIFF, PICT, etc
  • Photoshop saves/loads EPS (most), GIF, JPEG, PNG, TIFF, PICT, PDF etc