Skip to main content

Read and write Data Matrix from Python 3.8 and above.

Project description

Forked from pylibdmtx

Read and write Data Matrix in Python 3.8+ using the libdmtx library.


Features

  • Pure Python interface for libdmtx

  • Supports PIL/Pillow images, OpenCV/numpy arrays, and raw bytes

  • Decodes barcode data and locations

  • Minimal dependencies (only libdmtx native library required)

Installation

macOS

brew install libdmtx gettext

Linux (Ubuntu/Debian)

sudo apt-get install libdmtx0t64

Windows

Windows Python wheels do not include the required libdmtx DLLs. You need to download and add the DLLs manually to your system PATH or your project folder.

Python package

pip install pydmtxlib

Usage example

Here is a simple example demonstrating how to encode a string into a Data Matrix barcode and save it as an image, then decode it back:

from PIL import Image
from pydmtxlib import encode, decode

# Data to encode must be bytes
data = b"Hello, Data Matrix!"

# Encode the data
encoded = encode(data)

# Build a PIL image from raw pixels returned by encode()
image = Image.frombytes('RGB', (encoded.width, encoded.height), encoded.pixels)

# Save the image
image.save("datamatrix.png")
print("Data Matrix saved as 'datamatrix.png'")

# Open the saved image and decode
image = Image.open("datamatrix.png")
results = decode(image)

# Print decoded results
for result in results:
    print("Decoded data:", result.data.decode("utf-8"))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pydmtxlib-0.2.3-py2.py3-none-win_amd64.whl (65.5 kB view details)

Uploaded Python 2Python 3Windows x86-64

pydmtxlib-0.2.3-py2.py3-none-win32.whl (57.8 kB view details)

Uploaded Python 2Python 3Windows x86

pydmtxlib-0.2.3-py2.py3-none-any.whl (22.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pydmtxlib-0.2.3-py2.py3-none-win_amd64.whl.

File metadata

  • Download URL: pydmtxlib-0.2.3-py2.py3-none-win_amd64.whl
  • Upload date:
  • Size: 65.5 kB
  • Tags: Python 2, Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for pydmtxlib-0.2.3-py2.py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 06f5b0b2356c9c2ecf8924b0d6ceb42bd34e6d527c926a01858a4d747b157611
MD5 4ddeed614aa6c4080b260644ece549f0
BLAKE2b-256 9365d6f4c3c8b77d505067c40f9daf6b838911db87d8602ab594b43f0ca83980

See more details on using hashes here.

File details

Details for the file pydmtxlib-0.2.3-py2.py3-none-win32.whl.

File metadata

  • Download URL: pydmtxlib-0.2.3-py2.py3-none-win32.whl
  • Upload date:
  • Size: 57.8 kB
  • Tags: Python 2, Python 3, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for pydmtxlib-0.2.3-py2.py3-none-win32.whl
Algorithm Hash digest
SHA256 404d5091b52c78c0dc58a2cf88886582eb1d870d9c881e517c5a89f12f705c36
MD5 8dd311db761e746e6362bbc19b2dd670
BLAKE2b-256 b0cf2d088917c204cf014896443caa6b60171a5fbb625c3588fc543beca45d3f

See more details on using hashes here.

File details

Details for the file pydmtxlib-0.2.3-py2.py3-none-any.whl.

File metadata

  • Download URL: pydmtxlib-0.2.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for pydmtxlib-0.2.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 168fd149d9c633db1cc015389dc1b1c9cb60fa0ce76299f606eb3989c31ae39d
MD5 1fba9c012a80e70090662e1fcd6c6a9c
BLAKE2b-256 7be6b264ffe86f0beab54462322239e9e2946c3a0a05b04778210e8316dfd412

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page