
Well, you might be thinking, what does it matter? Why even think about this? I’ll just use a free QR code generator like what nearly everyone else does nowadays. But, surely it is important to understand how things work in this world? Isn’t it crucial that we know what goes on behind the scenes? In the code of those generators - what are the steps required to make a QR code? Well, that’s exactly what this article is about: a glimpse behind the scenes of a QR code.
Step 1: Convert Link into binary
The first step is that we’re going to need to convert the link that we’re using in binary so that it can be represented as black and white dots. We can’t change it directly to binary, so you have to convert to ASCII. Every character is assigned a number from 1-256. From there, we can convert it to the respective binary form. Convert all characters in the link to ASCII then binary, and you have the numbers.
Step 2: Setting up the QR code
Now that we have the binary numbers we need to make the QR code. Follow these formatting rules to make sure there aren’t any mistakes in the QR code:
The outside must be empty and of a uniform color.
Every QR code has position squares on the top-left, top-right and bottom-left. These are to identify the orientation of the code.
There is a fourth square in QR codes, however it is smaller, easier to spot and isn’t in the corner.
Next to the position squares (2), there are white strips isolating it from the rest of the code.
Connecting the bottom left square to the top left, add timing strips, which are designed like zebra crossings. Connecting the top ones like this too.
Next to the white strips, add the format strips. For the top right and bottom left, only add it to the side that’s facing the 4th square.
On the bottom left square, add a black dot to the top right of the perimeter of the square.
Step 3: Entering the code
Now we have all the non-data stuff complete and now it is time to place the code into the code. The data always starts at the bottom right corner.
The code goes up vertically in pairs, so the start would be on the right side then to its left, and then it goes up and does the same thing.
The first four digits (bottom right most) represent the data type. 0001 is numeric, 0010 is alphanumeric 0100 is binary and 1000 is Japanese kanji.
The following 8 characters represent the length of the number of characters in the code. Convert the number to binary and put it in on the QR code.
Now it is time to put the code. It follows a 2 bit long zig-zag pattern, so when you reach the top/bottom, just go backwards all the way down/up. Bypass any of the formatting that comes in the way.
Step 4: Error-correction code.
Your link may not have the entire QR code filled up, as the rest of the space is for error-correction code.
There are 4 levels of error-correction. Low can handle 7% lost, Medium is 14%, quartile is 25% and high up to 30%
In a QR code the entire data, even the character length byte and data type, are laid out in a line and converted back into ASCII decimals. The Reed-Solomon encoding uses finite field arithmetic, to get the error-correcting terms. Convert them back into binary, and that is used to fill out the rest of the QR code.
After adding a mask to your QR code, you have officially finished it. Your very own QR code.
コメント