Author image Avinash Chopde
and 1 contributors


barcodegen - create barcode images


barcodegen [options] TEXT

   TEXT              Generate Barcode for this text


   --type TYPE       Barcode type - Symbology
                     (default: Code39)

   --format=TYPE     Output format: png, jpeg, eps, pdf, gif, ... 
                     (default: PNG)

   --height=VALUE    Height in pixels of barcode (for non-QRcode type)
                     (default: 36)
   --notext          Create image with no text label (for non-QRcode type)

   --qrecc=[LMQH]    QRcode only - Error Correction Capability
   --qrversion=VALUE QRcode only - Version (1..40), size of image
   --qrsize=VALUE    QRcode only - Size of One Module

   --border=SIZE     White border of SIZE created around barcode
   --border=WIDTH[xHEIGHT]   White border WIDTHxHEIGHT in pixels created
                     (default: 10x7)

   --write=FILENAME  Output file name. By default image is output to STDOUT

   --help | -h | -?  Brief help message
   --man             Full documentation
   --verbose | -v    Informational and warning messages printed, to STDERR


barcodegen will create a barcode image from the given text, a single string is expected as the argument. The barcode image is printed to STDOUT, or written to a file. All barcodes supported by the GD::Barcode Perl module can be handled, for example: Code39 COOP2of5 EAN13 EAN8 IATA2of5 Industrial2of5 ITF Matrix2of5 NW7 QRcode UPCA UPCE. The default barcode type is Code39, and its character set includes the digits 0-9, the letters A-Z (upper case only), and the following symbols: space, minus (-), plus (+), period (.), dollar sign ($), slash (/), and percent (%).

The barcode can be output in any format supported by the Image::Magick perl module. The most common formats include: PNG, JPEG, GIF, EPS, PDF.

Pixel dimensions are used to specify the height and optional border. Resolution of 72 pixels/inch may be assumed when needed - such as in the PostScript output formats.


barcodegen ABC123DEF

Will output a PNG image to STDOUT, representing the barcode, with a text label. Default height of 36 pixels, and default border of 10x7.

barcodegen "ABC%123%" --format EPS --height 144 --border 10x7

Will output a Encapsulated PostScript file to STDOUT, with height of 144 pixels, the barcode text label, a border of 10 pixels on left and right sides, and a border of 7 pixels at the top and bottom.

barcodegen 01234567890 --type UPCA --verbose

Will output a PNG image to STDOUT, representing the UPC-A barcode for 01234567890, with a text label that includes the checksum (which is 5 for this barcode). Informational messages will also be printed to STDERR.


This script requires the following modules: GD::Barcode, GD, Image::Magick.