6

I need to "encode" a string into a Datamatrix code image, and am struggling the whole day to find a way (library) to do it.

Does anyone know a good python library for Datamatrix code generation? Or a way to do it?"

Thanks!

2 Answers 2

7

Elaphe library for barcode generation has datamatrix support.

Also, there is pylibdmtx

Sign up to request clarification or add additional context in comments.

2 Comments

pylibdmtx is still being updated actively and is now written in pure Python.
pylibdmtx is no more up to date, and doesn't have support of FNC1 for GS1. treepoem have big (and still unsolved) problems with dependencies installation. Tried on win and linux.
2

There is a library treepoem that allows conversion to most of the barcode types, which is being updated frequently.

https://pypi.org/project/treepoem/

eg: UPC-A,EAN-13,ISBN,PZN,I. 2 of 5,Code 39,Code 93,Code 128,Datamatrix,PDF417,QR,Micro QR, Aztec.

import treepoem 
image = treepoem.generate_barcode(
    barcode_type='datamatrix',  # One of the supported codes.
    data='barcode payload', 
) 
image.convert('1').save('barcode.png')

We also need to install ghostscript to run this.

https://www.ghostscript.com/download/gsdnld.html

For any errors while running in windows please follow the below link.

Treepoem barcode generator unable to find ghostscript

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.