CERN Accelerating science

This website is no longer maintained. Its content may be obsolete. Please visit http://home.cern/ for current CERN information.

CERN home page CERN home page The Consult page The Consult page This page The Consult page This page This page Help, Info about this page

Previous: Previous The A, B, C of NICE95: Drive-letters Assignment (See printing version)
Next: Next User Documentation


EPS, TIFF, GIF or JPEG? A Short Tutorial on Graphics Formats

  Nicole Crémel IT/User Support


A format, for a graphics file, corresponds to the method used by a graphical application (producing images) to write data on disks. Some formats are adequate for some specific tasks for which other formats would be totally inadequate. Depending on what you want to do some formats are better than others.

Basic Formats

Three types of basic formats are used to classify the type of data a graphics file contains:

  1. Bitmap files (also called raster files): the picture is stored as a matrix (row/column) of points named "pixels"; each pixel is defined by a value for its colour (or grey-scale value).
    Bitmaps files are generally produced by software specialized in image editing, like Adobe Photoshop, or software for piloting scanners.
    Well-known bitmaps formats are: GIF (Graphics Interchange Format), TIFF (Tagged Image File Format), JPEG (Joint Photographic Expert Group), BMP (Windows BitMaP), Mac Paint and PCX (PC PaintBrush).

  2. Vector files: the picture is composed of objects (mostly geometrical objects like lines, polygons, arcs, etc.) and the data associated to these objects are described as simple mathematical equations (like "start this line here and draw until that point").
    Vector files are typically used to store line art and CAD information.
    An example of this format is DXF (Data eXchange Format), the native vector file formats of Autodesk's AutoCAD CAD application.

  3. Metafiles: such files may contain either raster or vector graphics data (but not necessary containing both at the same time).
    CGM (Computer Graphics Metafile), DWG (AutoCAD DraWinG file), EPS (Encapsulated PostScript), IGES (International Graphics Exchange System), PDF (Portable Document Format) and PICT (Macintosh PICTure file) are well-known formats for metafiles.

It is sure that to be complete, more sophisticated formats should be added to this list:

 

Exchanging Graphical Data

Note that the purpose of all these formats is to give the possibility to exchange graphical data across different applications or to transmit graphical data to a printer. All software have their own "native" format, but a large number of software product can read and/or write other formats (which can be the "native" format of other software). For instance, PageMaker 6.5 can access native Illustrator files. This means in practice that some "trans-coding" process has to be run, either when you import graphical data from another software, or when you write your graphical data in a format different from the native one. You can understand that the resulting file (after "trans-coding") will be different from the original: a good "trans-coding" will just make it as close as possible. Sometimes differences are very small, sometimes they are more important. The quality of the translation is directly linked to the differences between the storing method of the import and output formats. One important factor is, for instance, the precision for the position of the objects. An example can be given with Illustrator, whose native format has a very good precision for this, whereas you will lose that precision when importing a PICT file format, where the position coordinates of objects are often rounded to integer values; consequently the position of objects can be slightly different when you will export this file.

 

Why such a Range of Formats?

Why all these formats which are not equivalent and sometimes specialized? And why do you sometimes run into problems when exchanging graphical data across different applications? These questions are quite complex. However it is sure that depending on the tasks to be performed and the device you use, some formats are more appropriate than the others.

Some formats are strictly linked to a system.

To be powerful many graphical formats depend on the characteristics of the system where they are displayed or printed. These formats are system-dependent. For instance, many bitmap formats (like PICT files, or TIFF files with indexed colours) do not certify the validity of their palette of colours when they are exchanged across systems/applications; consequently the image colour can be modified. Some vector formats in metafiles require the list of fonts to remain unchanged on the system because fonts are not referred by their name but just by a number; this is particularly bad when you want to add a new font on your system, or use another system. E.g. WMF - Microsoft Windows Metafile - which uses GDI (Windows Graphic Device Interface) is strictly linked to Windows and PICT based on QuickDraw is linked to the Macintosh. On the contrary, PostScript files (EPS) are a perfect example of system-independent graphical files.

Those system-dependent formats must strictly be used in the context for which they have been defined: the purpose of BMP is to display files on Windows and the printing is very bad; DXF and CGM have been designed for pen-plotters. EPS, TIFF, JPEG and GIF are not system-dependent and can be used across platforms and environments. However EPS and TIFF are specially designed for high resolution PostScript devices (printers). GIF and JPEG are good to transfer very large images in a very compact way: they are well suited for image editing and are, for the time being, the favourite format for pictures on the Web.

Some software does not read/write correctly some of the formats.

In many cases problems are not linked to the format itself, but to the behaviour of the import or export filter used by the application (to import or export files in a format different from the "native" format for this application).

Some formats are less powerful than others.

For example, the graphical model used by PICT, CGM and WMF, are not as powerful as the Illustrator PostScript drawing software, and cannot take into account all sophisticated features of such software.

 

Which Format to Use?

This mainly depends on what you want to do afterwards. We can only give some hints depending on what you want to do:

 

From one Format to Another with Specialized Software

Specialized software products exist to convert one format to another (e.g. DeBabelizer, from Equilibrium Tech. for Mac and Windows), but most software (e.g. from Adobe) can do it: e.g. Photoshop can read and write many bitmap formats (TIFF, GIF, JPEG + EPS). When reading a PICT file from a Macintosh into Illustrator all vector elements are converted into Illustrator drawing, and bitmap elements into TIFF. Then you just have to store the file into EPS. Even Pagemaker 6.5 can do such a conversion. Vector files are more difficult to convert and it might be more difficult to access a DXF, CGM or WMF file from a different application (although Adobe PDF can be used as an intermediate step).

Some useful "tricks":

 

CERN Tools on Unix (from ASIS repository)

Many "public domain" utilities exist for manipulating graphical data and converting them from one format to another. At CERN (on Unix) such tools/command are accessible from the ASIS software repository (/usr/local/bin or /usr/local/bin/X11). Following is a non-exhaustive list of graphical utilities available on all CERN central platforms:

For all the commands described above you can get more information through the "man pages", by typing "man <command_name>".

 

Pictures on the Web: GIF, JPEG and the Future - PNG

GIF and JPEG are the two graphical file formats most commonly used on the Web. As we already said those formats are very good to transfer very large images in a very compact way. The particularity of GIF is to exploit a compression mode without any data loss after decompression (using the LZW - Lempel-Ziv-Welch - a compression method patented by Unisys and IBM, sometimes also used by TIFF). The advantage of JPEG is to register RGB pictures with 24 bits depth (8 bits for each Red/Green/Blue colour): the RGB palette has more than 16 million values which provide many possible nuances. For compactness issues, GIF only uses a reduced palette with indexed colours, still allowing a quite good representation of all colours. A GIF picture can have maximum 256 different colours at a time, referred to by a number in a colour table (i.e. table of indices corresponding to RGB value).

A new graphics format, PNG (Portable Network Graphics, pronounced pingue), has been designed in 1997 by an Internet development group. This format is specially adapted to the needs of the Web: as does GIF, it exploits a compression method without any data loss after decompression, but, contrary to LZW, no license is required for it. With PNG it is possible to store the graphics data either with 24 bits colour, like in JPEG, or using indexed colours, like in GIF: this depends whether you wish to emphasize colour quality or smaller file size. PNG also offers new and more sophisticated features.

Some Web browsers - e.g. Netscape 4.04 onwards on Windows and Macintosh, Microsoft Explorer 4.0 - and software products - e.g Adobe Photoshop, Illustrator and PageMaker - are already able to vizualise this format, without necessarily exploiting all its possibilities Only 20% of the browsers are able to display PNG files for the time being, but this number should increase very quickly.

 

Image Format Table

To complete this tutorial we give you a table with a short description of most of the graphics formats which are available today.

Tag Description
AI Adobe Illustrator file format
AVS Application Visualization System X image file
BMP Microsoft Windows Bitmap image file
BMP24 Microsoft Windows 24-bit Bitmap image file
CGM Computer Graphics Metafile
CMYK Raw Cyan, Magenta, Yellow, and blacK bytes
DCX ZSoft IBM PC multi-page Paintbrush file
DIB Microsoft Windows Bitmap image file
DXF AutoCAD Data eXchange Format
DWG AutoCAD DraWinG
EPS Adobe Encapsulated PostScript file
EPS2 Adobe Level II Encapsulated PostScript file
EPSF Adobe Encapsulated PostScript file
EPSI Adobe Encapsulated PostScript Interchange format
FAX Group 3
FIG TransFig image format
FITS Flexible Image Transport System
FPX Kodak FlashPix Format
GIF CompuServe Graphics Interchange Format
GIF87 CompuServe Graphics Interchange Format
GKS Graphics Kernel System metafile
GRADATION Gradual passing from one shade to another
GRANITE Granite texture
GRAY Raw Gray bytes
HDF Hierarchical Data Format
HISTOGRAM Histogram of the image
HTML Hypertext Markup Language with a client-side image map
IGES International Graphics Exchange System
IV SGI Open InVentor format
JBIG Joint Bi-level Image experts Group file interchange format
JPEG Joint Photographic Experts Group JFIF format
MAP Colormap intensities and indices
MATTE Raw matte bytes
MIFF Magick Image File Format
MPEG Motion Picture Experts Group file interchange format
MTV MTV Raytracing image format
NETSCAPE Netscape 216 color cube.
NULL NULL image
PBM Portable Bitmap utility format (black and white)
PCD Photo CD
PCL Page Control Language
PCX ZSoft IBM PC Paintbrush file
PDF Portable Document Format
PGM Portable Graymap utility format (gray scale)
PICT Apple Macintosh QuickDraw/PICT file
PLASMA Plasma fractal image
PNG Portable Network Graphics
PNM Portable anymap utility
PPM Portable Pixmap utility format (color)
PS Adobe PostScript file
PS2 Adobe Level II PostScript file
PSD Adobe Photoshop
RAD Radiance image file
RGB Raw Red, Green, and Blue bytes
RGBA Raw Red, Green, Blue, and mAtte bytes
RLA Alias/Wavefront image file
RLE Utah Run Length Encoded image file
SGI Irix RGB image file
SHTML Hypertext Markup Language with a client-side image map
SUN SUN Rasterfile
TEXT Raw text file
TGA Truevision Targa image file
TIFF Tagged Image File Format
TIFF24 24-bit Tagged Image File Format
TILE Tile image with a texture
UYVY 16bit/pixel interleaved YUV
VICAR Video Image Communication And Retrieval rasterfile format
UIL X-Motif UIL table
VID Visual Image Directory
VIFF Khoros Visualization image file
VRML Virtual Reality Modeling Language
WMF Microsoft Windows Metafile
X select image from X server screen
XC constant image of X server color
XBM X Windows system bitmap, Black and white only
XPM X Windows system Pixmap file (color)
XWD X Windows system window Dump file (color)
YUV CCIR 601 4:1:1 file

 

More Information

You can find more information regarding "graphics file formats"

 

Further reading:

This short tutorial has been driven by two articles on this subject, translated to French and published in the Adobe Magazine:
[1]
Olav Martin KVERN, "Comment Faire?", Adobe Magazine (Ref. 1-1998).
[2]
Glenn FLEISHMAN, "A l'écoute du Web", Adobe Magazine (Ref. 2-1998).

The Reference book on this subject is the "Encyclopedia of Graphics File Formats" (~900 pages!) by James D. Murray & William VanRyper, which is sold at the User Support Bookshop.



For matters related to this article please contact the author.

Cnl.Editor@cern.ch



Last Updated on December 14th, 1998 at 16:28:45
Copyright © CERN 1998 -- European Laboratory for Particle Physics