zbar is a library for decoding barcode symbols. http://zbar.sourceforge.net/
zbar is provided as a package together with Androwish. In case someone wants to build zbar for Linux manually, chw provided the following instructions:
chw 2015-10-24: Should be possible with the latest check-in http://www.androwish.org/index.html/info/c82e1d09884d0458 . I've tested manually building it on a CentOS6 system with these commands:
$ gcc -fPIC -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 -DTCL_THREADS=1 -DPACKAGE=\"zbar\" -DPACKAGE_VERSION=\"0.10\" -c tclzbar.c $ gcc -shared -o libtclzbar.so tclzbar.o -lzbar -ltclstub8.5 -ltkstub8.5 $ wish8.5 % load ./libtclzbar.so Zbar
dzach 2015-10-25: To build zbar manually in a local directory, I brought the necessary files tclzbar.c and zbar.h in a the local dir, linked locally (can also be copied) as libzbar.so the /usr/lib/libzbar.so.0.2.0 lib that was installed with zbarcam from Ubuntu's repositories, and used chw's instructions above. For local compile/link, the linker command line should be:
$ gcc -shared -o libtclzbar.so tclzbar.o -lzbar -ltclstub8.5 -ltkstub8.5 -L/full/path/to/local/dir
If you don't want/know to mess with the environment settings, you may need to change the line:
#include <zbar.h>
in tclzbar.c to:
#include "zbar.h"
so that the file is looked up locally.
To use it as a TCL package, create a file pkgIndex.tcl with the following contents:
package ifneeded zbar 0.10 \ [list load [file join $dir libtclzbar[info sharedlibextension]] Zbar]
To use zbar, take a photo of a barcode from an item, e.g. food package, name it barcode_test.jpg, and then enter:
$ package require zbar 0.10 $ package req img::jpeg 1.4.4 $ image create photo test_img -file barcode_test.jpg test_img $ zbar::decode test_img 81 EAN13 2220063011920 ; # this is the result: milliseconds, symbol type, barcode
Documentation for the zbar tcl package, here