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-voptions for even more spew. or just hand itndirectly 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 to1. and symbology is one ofean13,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 withno-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 ofean13(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 forenableπ«emit-checkβ controls whether check digits are included in the decoded output. enabled by default. this config does not apply tocode128, which never returns the check digit. it also doesn't apply to cases where the check digit is disabled (seeadd-check). and check digits are currently not implemented fori25orcode39πadd-checkβ enables decode and verification of a check digit for symbologies where it's optional: this includescode39andi25, and neither of them implements the check digit yet πasciiβ enables escape sequences that encode the full ASCII character set. this would apply tocode39, 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 to0to disable the corresponding check. this setting applies to the variable-length symbologies:i25,codabar,code39,code128andpdf417.min-lengthdefaults to6fori25and1forcode39(per the Code 39 autodiscrimination recommendation); all the others default to0π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 to0disables scanning along that axis. defaults are both1π―
--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--displayor--nodisplayis 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 fromhttp://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 β¨
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
- arch rolling: zbar 0.23.95-1 Β· LGPL-2.1-or-later
- fedora 43: zbar 0.23.95-1.fc43 Β· LGPL-2.1-or-later
- fedora 44: zbar 0.23.95-1.fc44 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms