LinuxCommandLibrary

dmtxread

TLDR

Read Data Matrix barcode from image

$ dmtxread [image.png]
copy
Read from multiple images
$ dmtxread [image1.png] [image2.png]
copy
Output in verbose mode
$ dmtxread -v [image.png]
copy
Limit search to specific region
$ dmtxread -x [100] -y [100] -W [200] -H [200] [image.png]
copy
Set timeout for scanning
$ dmtxread -m [5000] [image.png]
copy
Output newline-separated (for multiple codes)
$ dmtxread -n [image.png]
copy
Read from webcam (with other tools)
$ fswebcam -r 640x480 - | dmtxread
copy

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.
-x, --x-min pixels
X coordinate of scan region origin.
-y, --y-min pixels
Y coordinate of scan region origin.
-W, --width pixels
Width of scan region.
-H, --height pixels
Height of scan region.
-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.

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

Copied to clipboard