Skip to content. Skip to navigation

ICTP Portal

Sections
You are here: Home ICTP User Guide Graphics
Personal tools
Document Actions

Overview

Bitmaps vs. Vector Images

There are two ways in which graphics can be stored: vectorized or bitmapped. In the first case, drawing commands are stored, like: "Draw a circle at (50,30) with radius 10; then a straight line from (10,15) to (50,30), ..." The image can be reproduced on any graphics device (monitor, printer, plotter) and scaled to any size without loss of quality. Another advantage is that the information doesn't need much space.

Bitmap sample Bitmaps on the other hand store images as matrices of discrete pixels, much like in this figure.

To obtain a fine image it is necessary to choose a resolution corresponding to the output device. Once you have chosen a certain resolution it is not possible to increase it, so you will not be able to adapt it to a finer output device (e.g. printers have a higher resolution than monitors). Bitmaps also take up a lot of space.

So, when should you use which type of format? Basically, whenever it is possible, save your graphics in vectorized form. Use bitmaps only when there is no other choice, i.e. with scanned-in images and pictures to be published on a Web page.

File Formats

In the Windows world, the standard format for vector graphic files is WMF ("Windows Metafile"). Often you are not even aware of using it, because graphics are usually embedded directly in the document files.

In UNIX the usual format for vector graphics is EPS ("Encapsulated Postscript"). It uses the Postscript language, but doesn't allow multi-page files (which makes sense, since it is supposed to describe a single image) and contains information on the size of the image instead. It can be easily included in LaTeX documents.

As for bitmapped images, JPG, GIF and TIFF are the most commonly used formats. JPG is ideal for color photos: the compression algorithm is very efficient. Some information gets lost, but to the eye of the viewer this doesn't appear significant.

GIF files use a compression algorithm that is less efficient but retains all the information. It is best used for computer generated images with no more than 256 colors. Both JPG and GIF files can be used for web pages.

TIFF files are used mostly for black and white (i.e. grayscale) images. They can be compressed or uncompressed.

BMP is the standard format for Windows bitmaps and is not compressed.

To convert a file from one format to another (or to manipulate it), use mogrify or gimp in Linux. The first one is a command line utility that helps you not only convert image file formats but also all kinds of other manipulations (see the man page), while gimp is a GUI program comparable to PhotoShop.

Producing Graphics

As explained earlier, you should always try to create vectorized images for your publications, except for web pages. But even then it might be a good idea to create a vector graphic first. They can always be converted to bitmaps, but not vice versa.

To plot functions or point data in two or three dimensions, use gnuplot. It is public domain and available for many computer platforms. If you find that Gnuplot is not sufficient, try using Mathematica or Maple see section Math Tools.

Xfig allows you to draw pictures containing ellipses, rectangles, lines and other geometrical elements. Those elements, once placed in the image, can be moved, copied, resized and deleted at will. Of course it is possible to produce an EPS file.

The use of all these programs is briefly explained in this Chapter.


Powered by Plone This site conforms to the following standards: