QR Codes Variety – Part two

QR code designers sweet spot

Truth is that I intended to look into choosing the right mask for a specific design we might have in mind. However I had a discovery that changed the order of things.

 Apparently there are some locations in the QR code that will allow you more drawing area. Let’s call the enclosing rectangle of our drawing or image – Canvas. Our canvas has a rectangular shape, and positioning it in these special locations will allow us to get closer to the limit of corruption area promised by the security level of the QR code, than placing it in any other location. Shift the canvas one module aside from this spot and the QR code is unreadable. This is right for every design and for every QR code!
In my eyes this is valuable information for every QR code designer.

Here it comes – first examples, white (rectangular) canvas – our version is 3 so our data area is 567 modules. Security level is high (30% for playing ground) so our canvas can span over an area of 170 modules (See a table for security level areas from my previous post).

So here is the rule – start at the corner without the finder pattern (there is always one and only one in every QR code), and put the right bottom corner of your canvas there. The canvas should be positioned in ‘portrait’ mode – it is also important that the short side (horizontal) will span on an even number of modules.

You can shift the canvas in steps of two modules to the left and 4 modules to the top to keep the good ratio between erased data and total –still decodable- QR code data.
I must be fair here and say that we are cheating a little bit. This is because normally the alignment pattern is close to this corner in all versions except version one (it simply does not exist there) and we cover it when it is not a part of QR code data. So actually we take out from data area 170-5×5=145 modules, this is 25% of data area – but visually it is an area of 30%. In any case this is 5% above the 20% percent or less you get if you put your rectangle elsewhere.

Why is location so important? It shouldn’t be so; the Reed-Solomon algorithm in its pure mathematic form has no dependency on location.
Here is the reason. Every character encoded in the QR code is built from 8 modules – let’s call this a unit. Usually units are in shape of 2×4 modules, where 4 modules are in the vertical direction. The modules inside the unit may be ordered in different ways. This is the order for the first unit of a QR code. It is always located at the corner without the finding pattern.

If you erase these 8 modules you erased one piece of data in terms of QR code. If your canvas area is 2×4 modules and you place it where it covers half of a unit to the left and half of a unit to the right, you are actually corrupting 2 units of data with the area of one! If you shift it up by one two or three modules you are corrupting 4 data units with a one unit canvas area!

Not a clever positioning is it? The more units you corrupt the smaller the chances for the QR code to recover from it. The best way to minimize the damage is to align your canvas with the character units of the QR code.  

Another interesting point is that the rectangular canvas prefers to be short on the horizontal and longer in the vertical direction. Why is this?
Remember the5x5 modules alignment pattern that we cover? Its height is 5 modules – not exactly the 4 modules height we love for the QR code units. This causes the perfect structures of 2×4 units to break into a jigsaw pattern. So if your canvas longer side is horizontal, the upper edge will cut too many units, the result? – Too many units will be corrupted and no reader will be able to read this.

Here is the way the units of data are arranged in version 2. I used here version 2 for simplicity. The units are numbered from 1 to 28 – which is the number of data units in version 2. The remaining unnumbered data units are the Reed-Solomon additional data added for providing us the security to remove parts of the data. Note you can remove units from the added security data, from original data or both. All it matters for the QR code is how many units are affected by your canvas (or your picture once you draw it).

Also note that 7 modules are left free – not belonging to any unit. This is redundant data and nobody uses it.

Now you can easily see that in higher versions when the upper side of your rectangle is wide, your canvas edge will split apart many units because of the jigsaw created, and by this corrupting actually much more units than when the horizontal side of the rectangle is narrow. Luckily for us the vertical direction still keeps on straight lines borders.

The ‘Golden Area’ rules

So here are the rules to maximize your drawing area on a QR code.
1 – Start at the single corner without the finder pattern.
2 – Position the rectangle in a ‘portrait’ mode – long side goes up.
3 – Start with aligning the right bottom corner of the canvas with the QR code corner.
4 – Check that the horizontal side of rectangle has an even number of modules in width.
5 – You can shift the rectangle in steps of two modules to the left (as long as the guide pattern is still covered- otherwise the rectangle area must diminish).
6 – You can try taking it 4 modules up (jigsaw pattern at the bottom might interrupt here).
7 – Do not forget to be below the permitted corruption area derived from the version number, and the security level.

Of course if you can break the rectangle borders to match better the real border units, you will improve by this the decoding rate, without scaling down your design.

Advertisements

About eismann oreilly

Recently bumped into QR codes, that ignited my imagination. The more I learn about them the more potential and possibilities are unveiled. With some help from your imagination we may find ourselves in a new world...
This entry was posted in designed QR codes, Qr code anatomy, QR codes, security level and tagged , , . Bookmark the permalink.

2 Responses to QR Codes Variety – Part two

  1. Great article but it’s really worth pointing out that the most important thing for a QR Code is that they scan. May seem obvious but printing a QR code onto something and then reducing the possibility that the user can actually scan it is surely worse than not printing it at all !

    • Thanks for opening my eyes – I do not of course corrupt QR codes for the sake of it. The intention behind putting white rectangles on QR codes and corrupting these rectangles info is for enabling designers to draw there their graphics. See http://qrarts.com/ and http://www.qrlicious.com/showcase/ for examples of decorated QR codes. It was so obvious to me that I did not highlight this point enough. I will take care of this future posts.
      Thanks again.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s