This post is going to look at the more aggressive means of decorating QR codes.
The first mean I will look at is adding a drawing as if it was a layer above the QR code, drawing on the QR code. There are ways to estimate the damage made to the QR code data when drawing on the QR code. A good estimation can guide us on how to make these changes in order to end with a QR code that is decodable and with a safe zone for additional damage that our final QR code may be exposed to.
Draw above the QR code
Here is a QR code with a logo over it. The EC of this QR code is High and its version is 2 (25 modules in each direction). The logo on the QR code to the left is drawn on a white rectangle as a background while the logo to the right has a transparent background.
14 codewords corrupted 10 codewords corrupted
No safe zone 9% left as safe zone
The table below contains information on the first five versions of QR codes and all EC levels for these versions. Looking at the table for version 2 and EC High we see that we can corrupt 14 codewords (an area of 14×8=112 modules – each codeword is 8 modules). The white rectangle that the logo is drawn on in the left QR code has dimensions of 10×8 modules which cover 80 modules. The codewords however do not fit exactly under the white rectangle and as a result 14 codewords are corrupted instead of the minimum 10 provided by the rectangle area. The transparent background around the logo in the right QR code reveals few modules along the logo bounding rectangle borders – which appears to rescue 4 additional codewords. 4 codewords out of the 44 total codewords are 9% of all data that can additionally be corrupted – which is a good safe zone.
To see how to get a good estimation on the amount of codewords that a drawing might corrupt look here
One thing that we can see from the last example is that whenever you can turn the background to be transparent – do it! It will provide you with few more codewords that will make your QR code more readable during its lifetime.
Bounding rectangle orientation
Codewords are arranged in clusters of 8 modules that usually span over 2 columns. Most of codewords do not sit exactly on 2 columns and 4 rows. Here are the two common patterns of codewords
This means that if your rectangle has one dimension longer from the other; put the long dimension to be vertical on an even modules border. The short dimension should be horizontal. The longer the horizontal dimension is the more corrupted codewords you will get be due to the broken pattern to the right above. The illustration below shows why.
This leads to the fact that tall rectangles have an advantage in QR codes over wide rectangles.
In the following QR codes the same area is covered by the blank rectangles drawn on the QR code
The tall rectangle to the left corrupts 11 codewords while the wide rectangle in the right corrupts 16 codewords – too much for Quality error correction level version 2 (only 11 codewords can be corrupted) – the QR code to the right is not readable.
However many times we want our rectangle to be horizontal – for example you may want to write some text in the available area such as below
Obviously the text would not fit so well in the vertical rectangle above. On the other hand the QR code will not decode with a horizontal rectangle. So – is there a solution?
Fortunately there is a solution! We can use the same area with a wide rectangle and let the QR code still be decodable. You do not rotate the rectangle but you rotate the QR code instead. QR codes can be read from any angle so if we take the QR code to with the tall rectangle and rotate it, we will get the same decodable QR code but this time the rectangle is short and wide and the text can go in; like this
Note that the position of the finder patterns changed. To the human eye there is no big difference between the last two QR codes, however one has no chance to be decoded while the other will be decoded.