dmtxread

Data Matrix barcode decoder

TLDR

Read Data Matrix barcode from image
$ dmtxread [image.png]
Read from multiple images
$ dmtxread [image1.png] [image2.png]
Output in verbose mode
$ dmtxread -v [image.png]
Set timeout for scanning (in milliseconds)
$ dmtxread -m [5000] [image.png]
Stop after decoding N barcodes
$ dmtxread -N [1] [image.png]
Output newline-separated (for multiple codes)
$ dmtxread -n [image.png]
Read from webcam (with other tools)
$ fswebcam -r 640x480 - | dmtxread

SYNOPSIS

dmtxread [options] image...

DESCRIPTION

dmtxread decodes Data Matrix barcodes from image files. Data Matrix is a 2D barcode format commonly used for small item marking, electronics, and industrial applications where high data density in small space is needed.The tool processes various image formats (PNG, JPEG, TIFF, etc.) and searches for Data Matrix patterns. Multiple barcodes can be detected in a single image. The decoded text is output to stdout.dmtxread is part of the libdmtx library, which provides Data Matrix encoding and decoding functionality. The library handles error correction built into the Data Matrix format.

PARAMETERS

-v, --verbose

Verbose output showing scan progress.
-n, --newline
Print newline after each decoded message.
-m, --milliseconds ms
Maximum scan time in milliseconds.
-N, --stop-after n
Stop after decoding n barcodes.
-c, --codewords
Print codewords instead of decoded message.
-e, --min-edge pixels
Minimum edge length to consider.
-E, --max-edge pixels
Maximum edge length to consider.

INSTALL

sudo apt install dmtx-utils
sudo dnf install dmtx-utils
brew install dmtx-utils
nix profile install nixpkgs#dmtx-utils

CAVEATS

Image quality significantly affects detection success. Very small, blurry, or damaged barcodes may not decode. Processing high-resolution images can be slow; use region limiting for better performance. Only supports Data Matrix format, not QR codes.

HISTORY

libdmtx and its tools were created by Mike Laughton and first released in 2006. The library provides open-source Data Matrix barcode support, filling a gap when most implementations were proprietary. Data Matrix itself was invented by RVSI Acuity CiMatrix in 1987 and became an ISO standard.

SEE ALSO

dmtxwrite(1), zbarimg(1), qrencode(1)