Barcode Encoding
Barcodes have been born in 1973 along with the UPC encoding. Barcodes are graphical, machine readable representations of the UPC, its variants and extensions.
In a barcode, each digit of an encoding is represented by seven black or white bars of equal size. Visually, two or more adjacent black bars appear as a single wide bar; white bars appear as space separators (also of varying size) between the black bars. If we call such wide (black or white) bars generalized bars, then, as a rule, a digit's representation always consists of four such generalized bars, which by necessity, interlace: either whiteblackwhiteblack or blackwhiteblackwhite.
Possible variants of 7bar representation are shown in the diagram below.
An UPCA code consists of twelve digits that are split into six left and six right digits. The digits in the two groups are barcoded differently. To barcode the first six (left) digits we use the "Left side (odd parity)" representation. For the next six (right) digits, use the "Right side" representation. One can easily observe that the difference between the two is in exchange of colors: white bars in one are black in the other, and vice versa. All twelve digits are represented by seven bars each, although on a barcode label the first and the last digits are place outside the barcode whilst the "middle" 10 digits are drawn beneath the barcode.
In the EAN13 encoding the situation is somewhat different. In an EAN13 code, the first digit does not have a barcode representation of its own, but its value has an effect on the representation of the next six digits. The entries in the following table refer to the "Left side (odd parity)" and the "Left side (even parity)" tables above.
(Note that the "Left side (even parity)" barcodes are the mirror images of the corresponding "Right side" barcodes.)

As you can observe, UPCA is easily (and commonly) embedded into EAN13 by prepending a 0 as the first digit.
Besides the aforementioned fact that every digit's barcode consists of four bars, we may make additional observations:
First of all, left side barcodes of either parity are of the form whiteblackwhiteblack and thus end in a black bar. The right side barcodes are of the form blackwhiteblackwhite and end in a space.
No (generalized) bar nor space is wider than four (regular) bars.
Any barcode starts and ends with three "guard bars": blackwhiteblack. Barcodes corresponding to "twohalves" encodings, like the UPCA and EAN13, also feature a middle guard in the form whiteblackwhiteblackwhite.
Contact Front page Contents
Copyright © 19962018 Alexander Bogomolny