DEV Community

Cover image for Let's develop a QR Code Generator, part X: creating larger codes

Let's develop a QR Code Generator, part X: creating larger codes

Massimo Artizzu on September 14, 2021

We're so close! We're just about to create a QR of any of the standard sizes, so nothing will stop us anymore! But before that… The vers...
Collapse
 
marianbraendle profile image
Marian Brändle

Hi, very nice series. However, I think the placement of the lower left version is wrong. It should be symmetric with respect to the main diagonal. It was probably not noticed due to the error correction of the QR reader.

Collapse
 
maxart2501 profile image
Massimo Artizzu

Hello, glad you liked the series!

From what I checked, the version information on the bottom left corner should be laid as described. This site (which has been a vital source of information for this series) confirms that.

Again, it's not clear why they chose to lay those modules like that. Maybe a little asymmetry can help redundancy in some way. Or maybe... there's no reason. Like the dark module being actually dark and not light: see this video where Veritasium's Derek Muller interviews Mashiro Hara, the inventor of QR Codes at Denso.

Collapse
 
marianbraendle profile image
Marian Brändle

Hi, thanks for the reply but I am pretty confident that the bottom version bits are wrong :)
You even have a nice diagram under "Placing the bits" that shows that the upper right block is symmetrical to the bottom left block with respect to the diagonal.
Additionally, on the site you linked you can also clearly see the symmetry in the QR code (under "Example of Version 7 Information String").

To make sure that everything is correct, you could use a QR scanner and first cover up the upper and then the lower version block and see if the QR code can be read correctly.
You will see that your QR code won't work if you cover up the upper right version block :)

A correct implementation can be found here, for example: github.com/nayuki/QR-Code-generato...

I hope this helps and I also hope that I am not completely wrong and talking nonsense :D

Thread Thread
 
maxart2501 profile image
Massimo Artizzu • Edited

Oooh that's interesting! So I guess the source I used here is incorrect.
The conclusive proof should come from the original ISO-18004 spec, I'll try to have a look when I can and update the article.
Thank you!

On a second thought, I understood your point wrong. The picture in the article is correct, and the modules are actually symmetrical there. The actual problem is this line:

matrix[5 - row][size - 9 - col] = bit;
Enter fullscreen mode Exit fullscreen mode

It should actually be

matrix[row][size - 11 + col] = bit;
Enter fullscreen mode Exit fullscreen mode

It's been a long time since I wrote this article, and I really don't know what happened there...

Thank you again!

Collapse
 
ashifkhan profile image
Ashif Khan

I WANT TO WORK ON THIS KINDA PROJECT. JUST WANTED TO KNOW WHATS THE LEVEL OF SHOULD I KNOW BEFORE JUMPING INTO THIS? CAN ANYONE CONFIRM?