Thursday, September 29, 2011

use python to decode qr code

 #!/usr/bin/python  from sys import argv import zbar import Image   # create a reader scanner = zbar.ImageScanner()  # configure the reader scanner.parse_config('enable')  # obtain image data     pil ="base.png").convert('L') width, height = pil.size raw = pil.tostring()  # wrap image data image = zbar.Image(width, height, 'Y800', raw)  # scan the image for barcodes scanner.scan(image)  # extract results for symbol in image:     # do something useful with results     print 'decoded', symbol.type, 'symbol', '"%s"' %  # clean up del(image)

1 comment:

lawtonterri said...

Perfect post. Learn how to incorporate QR codes in your web apps to deliver quick information directly to your users' mobile device