zbar command
Not logged in

zbar command

Name

zbar::* - interface to the ZBar barcode scanner library.

Synopsis

package require zbar
zbar::decode ?options?
zbar::async_decode ?options?
zbar::symbol_types

Description

These commands are used to scan barcodes off pixel image data.

zbar::decode photoEtc ?syms?

Scans the photo image photoEtc for barcode information. Alternatively, photoEtc can be a four element list describing a greyscale or RGB image as a byte array with 8 bits per color component. The elements must be width, height, number of color components and byte array of the image's pixels in this order. The optional parameter syms must be a list of barcode symbologies to be scanned for. If omitted, all known symbologies are tried. The command returns a three element list with the first element being the number of milliseconds spent on decoding. The second element is the decoded symbology on success or an empty string on failure, and the last element is the scan result as a byte array.

zbar::async_decode photoEtc callback ?syms?

Similar to zbar::decode but the decoder is run as a background thread and the result is presented to a callback procedure. It requires the Tcl core being built with thread support, and a running event loop since the callback is invoked as an event or do-when-idle handler. Three additional arguments are passed to callback: the number of milliseconds for decoding, the decoded symbology on success or an empty string on failure, and the scan result as a byte array. The optional parameter syms has the same meaning as in the zbar::decode command. Caution: only a single thread instance is supported per Tcl interpreter, i.e. another asynchronous decode process can only be started when a previous decode process has finished.

zbar::async_decode status

Returns the current state of the asynchronous decode thread as a string: stopped when no asynchronous decode thread has been started, running when a asynchronous decode is in progress, and ready when the next asynchronous decode can be started.

zbar::async_decode stop

Stops the background thread for asynchronous decoding if it has been implicitely started by a prior zbar::async_decode. This can be useful to conserve memory resources.

zbar::symbol_types

Returns a list of supported symbologies of the scanner, currently EAN8, UPCE, ISBN10, UPCA, EAN13, ISBN13, DATABAR, DATABAR_EXP, I25, CODABAR, CODE39, QRCODE, CODE93, and CODE128.