![[mysterious image]](/~inky/crap/innocent_qr_code.png)
On 31 August 2008, I posted a mysterious image to Tumblr, without comment. It looked just like the image on the right.
What on earth is that mess? Obscure system failure? Extraterrestrial crossword puzzle? Post–post-modern art?
No — no, it looks like one of those new-fangled 2D barcode things, right? Those weird little things with the dots and squares. Everybody's heard about them, but nobody ever sees them in the wild. Yeah, definitely one of those things. Tenner bets.
So what did it mean? If anything…
It was only a matter of minutes before the horrible truth was revealed.
Oh yes! Oh my, YES. Rickrolled by a bloody barcode.
It's actually called a QR Code. This is indeed a 2D barcode, or "matrix code", and it's considerably more flexible than a traditional barcode.
You can generate QR codes fairly easily using the Google Chart API. Naturally, the first thing that came to mind upon discovering this was the potential for rickrolling. Here is a short Python script which does just that:
#!/usr/bin/env python
import urllib
RICKROLL = """
Never gonna give you up,
Never gonna let you down,
Never gonna run around and desert you.
Never gonna make you cry,
Never gonna say goodbye,
Never gonna tell a lie and hurt you.
"""
BASEURL = 'http://chart.apis.google.com/chart?cht=qr'
ARGS = {
'chl' : RICKROLL.strip(),
'choe' : 'UTF-8',
'chs' : 500,
'chld' : 'L|4',
}
print '&'.join( (BASEURL, urllib.urlencode(ARGS)) )