Skip to content

Pylibdmtx

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

Install

pip3 install pylibdmtx

Ubuntu 계열 추가 설치:

sudo apt-get install libdmtx0a

만약 다음과 같은 에러가 출력되면:

However the following packages replace it:
  libdmtx0b

E: Package 'libdmtx0a' has no installation candidate

해당 패키지로 설치하자:

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

에러 출력:

E               ImportError: Unable to find dmtx shared library

libdmtx 라이브러리 설치하자.

See also

Favorite site