<h2>zbar command</h2>

<h3>Name</h3>

<b>zbar::*</b> - interface to the ZBar barcode scanner library.

<h3>Synopsis</h3>

<tt>package require zbar</tt><br>
<tt>zbar::decode ?options?</tt><br>
<tt>zbar::async_decode ?options?</tt><br>
<tt>zbar::symbol_types</tt>

<h3>Description</h3>

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

<tt>zbar::decode <i>photoEtc</i>

    Scans the photo image for barcode information. Alternatively, 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 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.

<tt>zbar::async_decode <i>photoEtc callback</i>

    Similar to <tt>zbar::decode</tt> but the decoder is run as a background thread and the result is presented to a 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 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 has the same meaning as in the <tt>zbar::decode</tt> 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.

<tt>zbar::async_decode status</tt>

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

<tt>zbar::async_decode stop</tt>

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

<tt>zbar::symbol_types</tt>

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