New Projects - Fresh from the Labs

libdmtx—Data Matrix Barcode Scanning (

I realise I tend to cover wacky things like molecule imaging, telekinesis and 3-D knitting software, but this is something that actually may be of genuine industrial use in everyday life. libdmtx is an open-source project dedicated to providing tools for reading and writing 2-D Data Matrix barcodes. The Data Matrix standard ( is gaining widespread popularity due to its impressive features, but it may be of particular interest to the FOSS community because it's unencumbered by patents and royalty-free (thus, free to use and distribute). Also, the existing proprietary solutions can be quite expensive, and libdmtx now has reached a point where it realistically can save some users six-digit savings every year.

Data Matrix barcodes also can hold secret messages along with the usual barcode data as shown here.

Data Matrix barcodes have been around since the 1980s, but for years, they were used only to mark electronic components. More recently, they have been adopted by a wide variety of industries in the US and Europe, and they are becoming especially popular with mobile phone developers due to their affinity to work with small digital cameras. Most US readers instantly will recognize Data Matrix barcodes, as they appear on most first-class mail delivered by the US Postal Service. Curious readers can snap a photo of their mail with a camera or Webcam and scan it with libdmtx without purchasing any special hardware (it also works well with faxed and scanned images).

libdmtx has the ability to find and decrypt barcodes under a variety of trying conditions.


Installing libdmtx is fairly straightforward with either a Debian package available under the name of libdmtx-utils or a source tarball. For those installing via source, compiling is basically the standard affair of:

$ ./configure
$ make

And, as root or sudo:

# make install

However, the configure script did come up with a dependency you probably won't have installed by default, GraphicsMagick. GraphicsMagick is in many distro repositories though, and to get past the configure script, I had to install libgraphicsmagick1 and libgraphicsmagick1-dev from the Ubuntu archive.

Once you have libdmtx compiled, before you can run the program, you probably will need to run the following command (as root or sudo):

# ldconfig


I cover only very basic usage in reading barcodes for now, but libdmtx also will write barcodes along with a bunch of other features that make it worth checking the man pages. First, grab an image to test. If you have a photo of a barcode around, great stuff, use that. Otherwise, some test images are available from the source tarball under the folder test/images_opengl, which cover a variety of different situations and tricky tests on libdmtx's abilities. Once you're ready to go, use the following command:

$ dmtxread nameofimage.png

And, that's pretty much all you need to do. dmtxread will spend a few seconds analyzing the image you've given it, and if it finds a matrix barcode, it then outputs the contained text to the terminal. Check the screenshot for some of the hidden messages and real-world codes that you can contain within a barcode.

What really intrigued me about this project is that you can recover barcode data from old pictures that never would have been meant for the purpose originally. And, the James Bond in me gets a kick out of knowing you can hide a message in a barcode in a seemingly unrelated picture as a covert method of communication—neat! Although this has just a command-line utility for now, it's really only a basic program on top of a very clever and versatile library. This project is begging for a GUI front end, at which point, it could make some serious inroads and savings in the real industrial world.


John Knight is the New Projects columnist for Linux Journal.

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState