Update of "dmtx command"
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.


Artifact ID: 578601101c191045f0c5380b9c82b80eaccc590c
Page Name:dmtx command
Date: 2017-01-15 12:03:08
Original User: chw
Parent: 38c5c0ea9df5c1c91cb9174e8416b5e5fad70145


dmtx::* - interface to the libdmtx.org Data Matrix Code scanner library.


package require dmtx
dmtx::decode ?options?
dmtx::async_decode ?options?


These commands are used to scan Data Matrix Codes off pixel image data.

dmtx::decode photoEtc ?scale timeout?

Scans the photo image photoEtc for Data Matrix Code information. Alternatively, photoEtc can be a four element list describing a greyscale or RGB image as a byte array. The elements must be width, height, depth and byte array of the image in this order. The optional integer parameter scale downsamples the image before the scan takes place. The optional timeout limits the scan process to that many milliseconds. The command returns a three element list made up of a flag indicating success (=1) or failure (=0) of the scan process, the amount of milliseconds spent on decoding, and the scan result as a byte array.

dmtx::async_decode photoEtc callback ?scale timeout?

Similar to dmtx::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: a flag indicating success (=1) or failure (=0) of the scan process, the number of milliseconds for decoding, and the scan result as a byte array. The optional parameters scale and timeout have the same meaning as in the dmtx::decode command. The default timeout value is 1000 milliseconds. 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.

dmtx::async_decode abort

Aborts a running asynchronous decode process.

dmtx::async_decode status

Returns the current state of the asynchronous decode 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.

dmtx::async_decode stop

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