Skip to content
Search

Pylibdmtx

lastmod 2024-09-23created 2024-09-233 edits

Read and write Data Matrix barcodes from Python 2 and 3.

Install

pip3 install pylibdmtx

Additional installation on Ubuntu-based systems:

sudo apt-get install libdmtx0a

If the following error is printed:

However the following packages replace it:
  libdmtx0b

E: Package 'libdmtx0a' has no installation candidate

Install that package instead:

sudo apt-get install libdmtx0b

Example usage

The decode function accepts instances of PIL.Image.

>>> from pylibdmtx.pylibdmtx import decode
>>> from PIL import Image
>>> decode(Image.open('pylibdmtx/tests/datamatrix.png'))
[Decoded(data='Stegosaurus', rect=Rect(left=5, top=6, width=96, height=95)),
 Decoded(data='Plesiosaurus', rect=Rect(left=298, top=6, width=95, height=95))]

Troubleshooting

ImportError: Unable to find dmtx shared library

Error output:

E               ImportError: Unable to find dmtx shared library

Install the libdmtx library.

See also

Favorite site

author Zer0 sitemap