Skip to content

Instantly share code, notes, and snippets.

@fbuchinger
Created July 8, 2010 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fbuchinger/468484 to your computer and use it in GitHub Desktop.
Save fbuchinger/468484 to your computer and use it in GitHub Desktop.
import sys
from PIL import Image
from pydmtx import DataMatrix
if __name__ == '__main__':
dmtx_image = Image.open(sys.argv[1])
(width, height) = dmtx_image.size
dm_read = DataMatrix()
dmtx_code = dm_read.decode (width, height, buffer(dmtx_image.tostring()))
if dmtx_code is not None:
print "Found Datamatrix code '%s' in %s" % (dmtx_code, sys.argv[1])
else:
print "No Datamatrix code found in %s" % (sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment