ZBARIMG(1)

πŸ’– ZBARIMG πŸ’–

okay so bestie, welcome to zbarimg from the ZBar Barcode Reader era β€” it's the little command-line icon that scans bar codes straight out of your image files. let's get into it πŸŽ€


✨ NAME ✨

zbarimg β€” scan and decode bar codes from image file(s) πŸ¦‹


✨ SYNOPSIS ✨

zbarimg [-qv] [--polygon] [--quiet] [--verbose[=n]]
        {-dD | --display | --nodisplay | --xml | --noxml |
        -S[symbology.]config[=value] | --set [symbology.]config[=value]
        | image...}

zbarimg {-h | --help | --version}

✨ DESCRIPTION ✨

So for each image file you hand it, zbarimg scans that image looking for bar codes, and prints whatever decoded data it finds to stdout. And if you want, the images can also be shown on screen. cute, right? πŸ’…

The library underneath currently supports these symbologies, no cap: EAN-13 (including the UPC and ISBN subsets), EAN-8, DataBar, DataBar Expanded, Code 128, Code 93, Code 39, Codabar, Interleaved 2 of 5 and QR Code. And the specific type of each symbol it detects gets printed right alongside the decoded data. the way that's so helpful fr fr ✨

🌸 quick heads up bestie: "image" here means literally any format ImageMagick supports β€” including lots of vector formats like PDF and PostScript. but keep in mind that vector formats get rasterized before scanning. so if you don't want to unintentionally corrupt embedded barcode bitmaps, manually rasterize those vector images yourself first. πŸ™ˆ

✨ OPTIONS ✨

This program follows the usual GNU command line syntax. Single letter options may be bundled, and long options start with two dashes (-). periodt πŸ’…

  • -h, --help β€” prints a short help message describing the command line options to standard output, then exits πŸ‘‘
  • --version β€” prints program version information to standard output, then exits ⭐
  • -v, --verbose[=n] β€” turns up the debug output level. stack multiple -v options for even more spew. or just hand it n directly to set the debug level yourself πŸ—£οΈ
  • -S[symbology.]config[=value], --set [symbology.]config[=value] β€” sets the decoder configuration option config for symbology to value. if you leave out value, it defaults to 1. and symbology is one of ean13, ean8, upca, upce, isbn13, isbn10, i25, codabar, code39, code93, code128, qrcode, or the special value *. if symbology is omitted or is *, the config gets set for all applicable symbologies. here are the currently recognized configs β€” and yes, you can prefix a config with no- to negate it. also ngl, not all configs are appropriate for every symbology πŸ’€
    • enable β€” controls decoding/reporting of a symbology. for the symbologies that are just subsets of ean13 (upca, upce, isbn13, isbn10), this config controls whether those subsets get detected and reported as such. these special cases are disabled by default, while all other symbologies default to enabled ✨
    • disable β€” the antonym for enable 🚫
    • emit-check β€” controls whether check digits are included in the decoded output. enabled by default. this config does not apply to code128, which never returns the check digit. it also doesn't apply to cases where the check digit is disabled (see add-check). and check digits are currently not implemented for i25 or code39 πŸ™ƒ
    • add-check β€” enables decode and verification of a check digit for symbologies where it's optional: this includes code39 and i25, and neither of them implements the check digit yet πŸ’€
    • ascii β€” enables escape sequences that encode the full ASCII character set. this would apply to code39, except that it's not implemented either... 😭
    • position β€” enables collection of symbol position information. enabled by default. currently the position information is unusable, so you can save a few cycles by disabling this. lowkey free performance 🫢
    • test-inverted β€” specially for QR code images: sometimes the image is inverted, e.g. lines are written in white instead of black. this option makes ZBar invert the image and parse it again, in case it fails using the normal order. enabling it affects all decoders 🌈
    • min-length=n, max-length=n β€” bounds the number of decoded characters in a valid symbol. if a decode result falls outside the configured min/max range (inclusive), it will not be reported. set to 0 to disable the corresponding check. this setting applies to the variable-length symbologies: i25, codabar, code39, code128 and pdf417. min-length defaults to 6 for i25 and 1 for code39 (per the Code 39 autodiscrimination recommendation); all the others default to 0 πŸ“
    • x-density=n, y-density=n β€” adjusts the density of the scanner passes. lower values scan more of the image, at the cost of decreased performance. setting to 0 disables scanning along that axis. defaults are both 1 🎯
  • --polygon β€” ouputs points of the polygon containing the code bar. uses a format compatible with The <polygon> element of the Scalable Vector Graphics (SVG) markup language πŸ–ΌοΈ
  • -q, --quiet β€” quiet operation; only outputs decoded symbol data. specifically, this disables the statistics line printed (to stderr) before exiting, plus the warning message printed (also to stderr) when no barcodes are found in an image 🀫
  • -d, --display, -D, --nodisplay β€” enables/disables display of subsequent image files, until the next --display or --nodisplay is encountered. this option may appear multiple times to enable display of specific images. image display is disabled by default πŸ‘€
  • --xml, --noxml β€” enables/disables result output using an XML format. this format wraps the raw data from the symbol with information about the scan (such as page indices) in an easy to parse format. the latest schema is available from http://zbar.sourceforge.net/2008/barcode.xsd πŸ“œ
  • --raw β€” enables raw symbol data output. this format prints symbol data separated by newlines without the additional symbology type information that gets printed by default 🧼

✨ EXAMPLES ✨

Scan a PNG image of a UPC bar code symbol and pass the resulting data to a script that searches for the code in a database and does something useful with it:

zbarimg product.png | upcrpc.py

The upcrpc.py example script included in the examples/ subdirectory of the distribution will make an XMLRPC call to a popular internet UPC database and print the product description if found. iconic behavior tbh πŸ’–


Scan a JPEG image containing several barcodes and display the image in a window, also disabling recognition of Interleaved 2 of 5 codes to prevent confusion with other symbologies or background noise:

zbarimg --display -Si25.disable label.jpg

Look in a scanned document only for Code 39, using XML output format so the page numbers are available. To enable only Code 39, first all symbologies are disabled, then Code 39 is re-enabled:

zbarimg --xml -Sdisable -Scode39.enable scan.tiff

slay. that's the whole trick πŸŽ€


✨ EXIT STATUS ✨

zbarimg returns an exit code to indicate the status of the program execution. current exit codes are:

  • 0 β€” barcodes successfully detected in all images. warnings may have been generated, but no errors. we love a clean run ✨
  • 1 β€” an error occurred while processing some image(s). this includes bad arguments, I/O errors and image handling errors from ImageMagick. 😭
  • 2 β€” ImageMagick fatal error. πŸ’€
  • 3 β€” the user quit the program before all images were scanned. only applies when running in interactive mode (with --display). πŸƒβ™€οΈ
  • 4 β€” no barcode was detected in one or more of the images. no other errors occurred. πŸ™ˆ

✨ SEE ALSO ✨


✨ BUGS ✨

See http://sf.net/tracker/?group_id=189236&atid=928515 πŸ›


✨ AUTHOR ✨

Jeff Brown <spadix@users.sourceforge.net> Lead developer πŸ‘‘


Copyright Β© 2007-2010 Jeff Brown

All Rights Reserved


okay bestie that's the whole page 🫢 go scan something cute. and fr fr, this was zbar-0.23.95, dated 2017-04-11 β€” ZBARIMG(1) out πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from