Questions? Search our site or call us at 1-800-722-6004

Raster vs Vector Images and How They Relate to Barcodes

Explains the important difference between different graphic formats commonly used to create barcodes. Which format is best for producing the highest quality barcodes?

A barcode is comparable to a printed version of the Morse code. Instead of dots and dashes to represent characters, barcodes use the widths of black bars and white spaces. It is extremely important that the widths of the bars and spaces are printed within precise tolerances in order to be readable by most barcode readers. How the barcode is produced including the type of graphic that is originally used is therefore extremely important. Microsoft Windows supports three native graphic types that are commonly used to create barcodes; bitmaps, fonts and metafiles.

BitMaps

A bitmap is an array of dots or "pixels" where each pixel (picture element) has a value that represents the color of the pixel. The width of a bitmap is defined by the number of pixels across a row. The height of the bitmap is defined by the number of rows of pixels. Any graphic that is made up of rows of dots is called a "Raster" graphic therefore a bitmap is a raster graphic. The overall printed dimensions of a bitmap is dependent on the dot resolution of the device used to print it. For example if you create a bitmap graphic that is 300 pixels wide and has 300 rows of pixels and then you print this bitmap on a printer that has a dot resolution of 300 dots per inch, you will end up with a printed image one inch square. If you display the same bitmap on a computer screen that has a dot resolution of 100 dots per inch, you end up with an image that is three inches square. This means that bitmaps are "device dependent" where the resolution of the rendering device (i.e. printer or screen) must be taken into consideration when you create the image. If you need to preserve the size of an image from one device to another, (i.e. screen to printer) you must "stretch" or "shrink" a bitmap to fit the desired size. The process of stretching and shrinking involves either adding or removing pixels to or from the original image. As you can imagine resizing a bitmap to a desired size when moving from one output device to another generally causes a severe degradation of the original image quality. Therefore, when creating precise graphics (like barcodes) it is extremely important that the image is created with the same dot resolution of the printer. If you do not know the dot resolution of the printer that will be used to print the barcode then you cannot fully guarantee that the image will be readable by all barcode readers.

A type of bitmap called a "Device Independent Bitmap" has been developed as an attempt to solve the device dependency problem however you still end up with distorted images when you render a bitmap on a device that does not have the exact same dot resolution that the bitmap was created with.

Another problem with bitmaps is that they require large amounts of memory. For example a bitmap that is 300 pixels wide and 300 lines down (only 1 square inch on a 300 DPI laser printer) and has three bytes per pixel of color information (standard RGB colors) will require 270,000 bytes of memory or disk space. For barcodes, this is a huge amount of space for a very simple graphic made up of a relatively small number of rectangles.

Fonts

Although fonts are not normally thought of as graphics, they can be used to produce barcodes. A font is a collection of graphic elements that are assigned to each of the characters in the ASCII or ANSI character set. Because most barcode symbologies encode data by mapping specific characters to specific bar and space patterns, it is possible to use fonts to create barcodes. Unfortunately, fonts have many inherent problems when they are used to create barcodes.

The most important problem with fonts when they are used to create barcodes is that they are not "intelligent". Almost every barcode symbology has features like start and stop patterns, check digits, guard patterns, quiet zones and bearer bars. When you use a font to create a barcode you cannot simply select the text for the message that you want encoded and select a barcode font. You first have to insert special characters for the start and stop patterns as well as manually calculate and insert a special character for the check digit. In almost all cases you have to use a special program provided with the font to calculate and add check digits and insert start and stop patterns. Another problem with fonts is that they cannot be scaled in a single direction in most application programs. Some specialized desktop publishing programs allow stretching of fonts in a single direction however most database or word processing programs do not. This means that if you increase the size of a font, both the height and the width change. When creating barcodes, it is extremely important that the width of the bars and spaces remain constant. Typically the height of a barcode font is not adequate and it must be scaled up. When you do this by increasing the font size, the width of the bars and spaces as well as the overall width of the barcode increases proportionally which causes the barcode to be rendered out of spec. In general fonts are the poorest choice for creating barcodes. They offer the least control of all possible methods for creating barcodes.

"Barcode fonts have been known to create EAN/UPC symbols with serious quality defects. The problems may be caused by the inherent design of the font, operator input, or a combination of both..." Uniform Code Council, Inc., Guidelines for Providers of EAN/UPC Symbol Design Software, 1997, Page 13.

"For these reasons, extreme caution should be used when producing EAN/UPC symbols with barcode fonts. They should only be used by highly experienced barcode design professionals utilizing appropriate controls" 

This is true when using fonts to create any barcode symbology.

Metafiles

The absolute best way to create barcodes is to use a vector style graphic. Instead of containing an actual raster style image (like a bitmap), a vector graphic contains a sequence of drawing instructions that describe how to render the image. For example it might contain an instruction that tells the output device to move to a point exactly two inches down and to the right from the upper left corner of the screen or page and draw solid black rectangle that is exactly a quarter of an inch wide and one inch tall.

The Windows metafile (WMF) and the Encapsulated Postscript (EPS) graphics formats are "vector" graphic formats. The prominent features of the WMF format is that it is completely device independent, it supports extremely precise dimensions for all graphic elements (down to 1/100th of a millimeter) and the amount of memory required to store a metafile is extremely small. Best of all, every printer that has a Windows printer driver must support printing metafiles therefore there is never an issue with being able to print metafiles on a particular printer. The characteristics of metafiles are ideal for creating barcodes.

As an added bonus, most programming languages and commonly used Windows programs provide built in support for handling metafiles. Metafiles are in fact built from the natural "graphics language" used by Windows for creating almost all graphic elements used in every Windows program. Widows also provides built in clipboard support for the metafile format which makes it extremely easy to move them between applications.

The only problems that you might encounter with metafiles is that some service bureaus have trouble printing them on a small number of high resolution film mastering devices. Typically the problems that they encounter are because they are using older, outdated printer drivers. Service bureaus generally prefer the EPS graphics however most Windows programs do not have the ability to render EPS images on screen making EPS files difficult to work with. For example PageMaker for Windows will allow you to insert EPS files into a document however when you do so, PageMaker only displays a rectangle where the image would appear in the document. You will not see the image on your screen unless the EPS file has a TIFF preview embedded in the EPS file. (A TIFF is a type of raster graphic similar to a bitmap. Both EPS and WMF files can contain raster images embedded as part of the vector graphic.)

B-Coder Pro and B-Coder Lite

TAL's B-Coder barcode graphic generating software can create barcodes in ANY graphic format - including Windows Metafile (.WMF), EPS, TIFF, bitmap, GIF, JPEG, AI, PCT, PCX, etc... However for the reasons given above we recommend that you one of the vector formats, i.e. WMF or EPS if possible.

Windows Applications

- Word, Access, PageMaker, WordPerfect, Quark, etc.
Generally in Windows the WMF format is best as all printers can print perfect WMF graphics from Windows however only postscript printers can print EPS (Encapsulated Postscript) graphics. Hence WMF is the "default" graphic format in B-Coder.

Mac OS (Apple)

If you are going to be printing from a MAC we recommend you use the EPS graphic format in B-Coder. This allows all EPS options including selectable TIFF preview for the EPS.

Internet

If you are going to be showing the barcodes on web pages then you will want to use the GIF or JPEG options, however the quality of these barcodes will be much lower as GIFs and JPEGs are raster graphics.

The other graphic formats supported by B-Coder (bitmap, TIFF, PCT, PCX, TGA, CTM, WPG, DRW, etc.)are provided for special situations or for specific applications that have limited graphic support. They are all raster graphics so they should only be used if you have no other choice.

Imaging Device Resolution in DPI*
Bit-map Images 100 - 400 dpi  (device dependent)
Vector Images 100 - 4000+ dpi (device independent)
Thermal Barcode Printers 100 - 400 dpi (with resident barcode formats)
General Purpose Printers 300 - 1200 dpi (laser, inkjet, etc..)

Image setters

1200 - 4000+ dpi (i.e. Linotronic printers)
*Taken from Guidelines for Providers of EAN/UPC Symbol Design Software

Testimonials

"I got a lead on WinWedge from another user. I bought the software and it works GREAT! I love this program! It has saved me hours of research and programming time! Well worth it!"

Ed Grainger Hamilton, Ontario

"There is not a person I would rather recommend to someone than you. Boy, if every support person was like you, people would have to learn to speak without curse words, the average blood pressure of users/customers would drop significantly, etc.. I'd be more than happy to talk with any potential users (of TALtech software)."

Tom Barth PriceWaterhouseCoopers

News & Updates