Hiding Space Invaders In QR Codes

One of the lovely aspects of QR codes is the variable levels of error correction built in.  On even the most basic code you can obscure or deform up to 7% of the code and most readers will still decode it.

This leads us in to the amusing territory of "hiding" human readable data in the code.  I say "hiding" because we are hiding it from the scanner - not from the human.

One of the more famous examples of this is Duncan Robertson's BBC logo.

BBC Logo in a QR CodeWhat works particularly well is the fact that the BBC logo is already black and white, and fairly blocky.


After my sojourn alien hunting in Paris, I realised that there is another blocky character which most people will recognise - the humble Space Invader!

In this first code, I've made the Invader small and hidden her in some blank space.
Hidden Space Invader
Because she's around the same size as the surrounding pixels, any error she generates is cancelled out.

We can also use Duncan's technique and obscure part of the code.
Space Invader

How Not To Be Seen

While the boys of Monty Python can tell you how not to be seen, for computer vision, it's rather different.

Essentially, what most QR scanners do is look at a greyscale view of the image in front of them.  The lighter the colour, the more likely the optical recognition algorithm is to see it as "white".  This allows you to put dark coloured QR codes on to a light coloured background and still have them read.

So, in theory, we could fill up every pixel of white space with a different light colour and still be perfectly readable.

In this example, I've filled in some of the white space with light green.
Space Invader hidden in whitespace
When seen in greyscale, the green is discarded and no extra error is introduced.

Other Examples

Optiscan have gone a whole lot further and coloured in the entire code
QR Code coloured in to look like an alien.

They claim that their app will quite happily read this code. As it's iPhone only, I wasn't able to verify - but as a rule, increasing the colour complexity will reduce the chances of a phone being able to successfully read your code. It's a fine balance between readability and aesthetic improvement.

The excellent QR Monkey has a blog post detailing several different techniques for prettifying your QR Codes.

QR Monkey

Another example of how far you can go is this QR Quilt from Rubi Studios.
QR Quilt

In short - you can go pretty wild with your QR designs. Just remember to up the error correction and make sure that contrast between the colours you use is sufficiently high for most scanners. When in doubt - test!

9 thoughts on “Hiding Space Invaders In QR Codes

  1. says:

    Love'em 🙂 - Are there any good ways to check how badly you've mangled the QR code once you've redesigned it, or is it just a matter of %'age change?

    1. It's mostly a matter of %age change. There are some online decoders like http://zxing.org/w/decode.jspx - but none that I know of which will tell you how many errors it encountered.

      You can change the level of error correction, see http://code.google.com/apis/chart/docs/gallery/qr_codes.html#overview
      * L - [Default] Allows recovery of up to 7% data loss
      * M - Allows recovery of up to 15% data loss
      * Q - Allows recovery of up to 25% data loss
      * H - Allows recovery of up to 30% data loss
      Obviously, the more error correction, the bigger the code.

  2. says:

    Hi Terence, thanks for including my alien QR in your blog post! I guarantee it reads perfectly (and quickly) in Optiscan, although I know others have issues. Error correction helps, but - as you say - getting the balance right between light and dark is essential. One complete failure of QR Code use recently was in a print piece for the Vatican - the QR Code colours were reversed to fit the ad better and so consequently didn't read at all!

  3. [...] wonderful QR code constructed out of Tetris pieces.The full size version is a work of beauty.As I’ve explained before, this works because the QR scanner sees the image in black and white – so light colours [...]

  4. […] Terence speaks of integrating image creation into his QR code API which could automatically be linked to the final destination. Read his brief post here: QRpedia and Images and his more comprehensive ‘Hiding Space Invaders In QR Codes‘. […]

Leave a Reply

Your email address will not be published. Required fields are marked *