zint
Encode data into barcode images
TLDR
Generate a barcode and save it
Specify a code type for generation
List all supported code types
SYNOPSIS
zint [OPTIONS] -o <output_file> [-d <data_string> | -i <input_file>]
PARAMETERS
-b <symbology_id>
Sets the barcode symbology to be used. Refer to zint documentation or run zint -L for a complete list of numeric IDs (e.g., 47 for QR Code, 2 for EAN-13).
-d <data_string>
Specifies the data to be encoded in the barcode directly as a string.
-i <input_file>
Reads the data to be encoded from the specified input file. Each line can represent a separate data item for batch processing.
-o <output_file>
Sets the output filename for the generated barcode. The file extension determines the output format (e.g., .png for PNG, .svg for SVG, .eps for EPS).
-h <height>
Sets the height of the barcode in modules. This option is specific to 1D barcodes and some 2D codes with variable height.
-w <width>
Sets the width of the barcode in modules.
-s <scale>
Sets the scaling factor for the barcode. A value of 1.0 means default size, 2.0 means double size.
-t <text>
Specifies human-readable text to be displayed below the barcode, overriding the default if not empty.
-x
Hides the human-readable text below the barcode.
-v <version>
Sets the symbol version or error correction level for 2D barcodes (e.g., QR Code, Aztec Code). Higher values mean more error correction or data capacity.
-F <hex_color>
Sets the foreground (bar) color of the barcode in hexadecimal RGB (e.g., 000000 for black).
-B <hex_color>
Sets the background color of the barcode in hexadecimal RGB (e.g., FFFFFF for white).
-r <degrees>
Rotates the barcode image by the specified degrees (0, 90, 180, 270).
-m
Adds quiet zones (white margins) around the barcode, which are crucial for reliable scanning.
-S <option>
Sets specific symbol options (e.g., gs1 for GS1 symbologies, square for square 2D modules, invert to invert colors).
DESCRIPTION
zint is an open-source barcode encoding library and command-line utility designed to generate a comprehensive range of 1D (linear) and 2D (matrix) barcode symbologies. It supports popular types like QR Code, Data Matrix, Aztec Code, EAN, UPC, Code 128, GS1 DataBar, and many more. Users can specify the input data directly or from a file, select the desired barcode type using a numeric ID, and define the output filename. The output format (e.g., PNG, SVG, EPS) is automatically determined by the file extension of the specified output file. zint is highly versatile, capable of generating high-quality vector and raster images suitable for printing, web applications, or any data encoding task. Its flexibility and extensive symbology support make it an invaluable tool for developers and users needing to create barcodes programmatically or from the command line.
CAVEATS
zint relies on external libraries for certain image output formats (e.g., libpng for PNG, librsvg for SVG, libtiff for TIFF). Ensure these dependencies are installed for full functionality. The numeric symbology IDs can be extensive and require consulting the zint documentation or using the -L option to list them. Output format is strictly determined by the -o filename's extension.
SUPPORTED OUTPUT FORMATS
zint can output barcodes in various raster and vector formats, determined by the output file's extension specified with -o. Common formats include:
PNG (.png), SVG (.svg), EPS (.eps), TIFF (.tif, .tiff), BMP (.bmp), GIF (.gif), JPEG (.jpg, .jpeg), PCX (.pcx), WMF (.wmf), EMF (.emf), ASCII (.txt for ASCII art), PostScript (.ps).
SYMBOLOGY IDS
To use zint effectively, understanding the numeric IDs for each barcode symbology is crucial. These IDs are passed with the -b option. For instance, '2' represents EAN-13, '47' represents QR Code, '58' represents Data Matrix, and '70' represents Code 128. A full list can typically be found in the zint documentation or by running zint -L.
HISTORY
zint was initially developed by Robin Stuart, with its first public release around 2005. It was created to provide a comprehensive, open-source, and cross-platform solution for barcode generation, addressing the need for a tool that supports a broader range of symbologies than many existing options. Written primarily in C, it has since grown into a robust library and command-line utility, widely adopted in various applications for its reliability and extensive feature set.