Code 128

Synopsis

code128 barwidth string [> output-file]

Description

Code128 generates barcode images in JPG (or GIF, if you don’t have a copy of libjpeg on your system) using Boutell.com’s GD graphics library. It takes two arguments — the width of the smallest bar in the output (typically 1; the title image on this page uses 2) in pixels, and the string you wish to generate a barcode of. It encodes that string using the Code 128 barcode format, and dumps the resulting image to standard out.

If your system has a new version of GD and the IJG’s libjpeg, code128 produces a jpeg image, otherwise it produces a GIF image.

Bugs

  1. The GIF image format is patented by Unisys, and that patent will not expire internationally until the end of June, 2004.
  2. Code 128 format barcodes can get to be fairly long. A code 128 barcode is 11 barwidth long per character, plus 35 barwidth for the message envelope.

Source Code

Code128 uses my configuration system to configure itself for building on various platforms. To build the code, untar the archive, run configure.sh, then run a make.

version 0.2
The first release. It’s version 0.2 because version 0.1 didn’t include the copyright notice.