illuminated
illuminated

Reputation: 145

Datamatrix code generation with python

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!

Upvotes: 6

Views: 19203

Answers (2)

cleg
cleg

Reputation: 5022

Elaphe library for barcode generation has datamatrix support.

Also, there is pylibdmtx

Upvotes: 7

user13946773
user13946773

Reputation: 61

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

Upvotes: 2

Related Questions