44

Looking for free/opensource code or description of algorithms to code (simple) and decode (hard) the 2D barcode QR code.

It doesn't seem like a trivial problem, but it's so popular in Japan that there must be something already available...

2
  • 16
    Apparently the Japanese specification of QR codes is free, but the International Standards Committee (ISO), decided to charge over 200 Swiss francs for the English version. If the English version is just a translation of the Japanese one then I'd say for that price, it's totally unethical. Commented Feb 24, 2010 at 8:38
  • To understand the reed solomon error code specififcation used in qr code refer math.stackexchange.com/questions/76045/… Commented Nov 4, 2011 at 5:27

9 Answers 9

30

I have a colleague who worked on ZXing ("Zebra Crossing").

That's got a fair variety of platform support.

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

2 Comments

ZXing looks really nice.
they've halted development on this package, so this post should be improved to not link to ZXing
15

QR Code Demystified - Part 1
QR Code Demystified - Part 2
QR Code Demystified - Part 3
QR Code Demystified - Part 4
QR Code Demystified - Part 5
QR Code Demystified - Part 6

and

http://www.thonky.com/qr-code-tutorial/introduction/

To know the Mathematics theory behind it there is a discussion in Math Stackexchange

https://math.stackexchange.com/questions/76045/reed-solomon-polynomial-generator

Comments

12

http://www.swetake.com/qrcode/qr1_en.html

Just thought I'd mention this one which is explaining HOW they work.

2 Comments

The URL is broken, I guess the updated one is: swetake.com/qrcode/qr1_en.html. Cannot edit the post as there are too few characters changed...
Thanks, fixed that.
11

(In response to those asking about QR codes in PHP)

The Google Charts QR chart type might work for you, if you don't expect a lot of traffic, or if you can cache the images. It's extremely easy to use- just put the text to encode in the URL.

Comments

10

Here's a good LGPL library for encoding QR code libqrencode

Libqrencode is a C library for encoding data in a QR Code symbol, a kind of 2D symbology that can be scanned by handy terminals such as a mobile phone with CCD. The capacity of QR Code is up to 7000 digits or 4000 characters, and is highly robust.

Here's a Google code project that decodes QR code - aimed at iPhone, but is LGPL and the source is available. Should be adaptable...

-Adam

1 Comment

For those looking to encode and decode datamatrix codes (another common 2D barcode format) then libdmtx.sourceforge.net is a C library that encodes and decodes them.
8

PyQrCodec is a Python library for encoding Qr codes to a PNG and decoding them from a variety of image formats.

2 Comments

That link is dead.
Here's one (same?) pyqrcode.sourceforge.net
2

You can find c# example here http://twit88.com/home/opensource/qrcode for free (only need to register)

Comments

2

You can use zbar directly to decode the qrcode.

#!/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 = Image.open("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"' % symbol.data

# clean up
del(image)

Comments

1

You can try python-qrtools: https://launchpad.net/qr-tools It uses qrencode for generating and zbar for decoding (from webcam or a file ;-)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.