187 lines
12 KiB
Plaintext
187 lines
12 KiB
Plaintext
|
|
Episode: 934
|
||
|
|
Title: HPR0934: LiTS 001: qrencode
|
||
|
|
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr0934/hpr0934.mp3
|
||
|
|
Transcribed: 2025-10-08 05:08:41
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
Welcome to Linux and the Shell Episode 1.
|
||
|
|
My name is Dan Washco.
|
||
|
|
I'm your host, and today we are going to talk about the QR Incode application.
|
||
|
|
But before we do that, let's talk about QR codes or quick response codes.
|
||
|
|
QR codes were originally developed by the automotive industry.
|
||
|
|
Or the use of scanning parts.
|
||
|
|
They developed this because of the limitations of the current scanning codes, primarily
|
||
|
|
barcodes at the time, were not stored enough that a barcode stores about 20 digits.
|
||
|
|
But QR codes can store up to 7,089 characters and can handle an array of data, including
|
||
|
|
alpha, numeric, binary, and kanji, as just opposed to numeric data.
|
||
|
|
Now how does it do this?
|
||
|
|
Well, a traditional barcode holds data only on a horizontal plane.
|
||
|
|
So it can only be read horizontally.
|
||
|
|
Whereas the QR code is a 2D code and a matrix, which allows data to be read both horizontally
|
||
|
|
and vertically, therefore allowing for far more data and other features like error correction
|
||
|
|
into the QR code to be scanned in.
|
||
|
|
QR code can be read in 360 degrees because it has what is a called a position detection
|
||
|
|
patterns around it.
|
||
|
|
Now, if you've ever seen a QR code, they are little squares with a whole lot of almost
|
||
|
|
like white noise data in them and typically have on the lower left, lower upper right,
|
||
|
|
and upper left corners, a larger square.
|
||
|
|
Compared to the rest of the data, really well defined squares.
|
||
|
|
Those are the position detection patterns there.
|
||
|
|
And they determine the order which the code could be read.
|
||
|
|
So no matter what direction the code is read from, the data is always read properly.
|
||
|
|
Because of this position detection patterns, QR codes can actually be appended inside
|
||
|
|
one another in a structured format.
|
||
|
|
So that is another benefit over the standard barcode.
|
||
|
|
And I had said that QR codes are a square of black and white dots.
|
||
|
|
And what they are, what those black and white dots are grouped together in what is called
|
||
|
|
modules.
|
||
|
|
Now, the number of modules in a QR code is determined by the version of the QR code.
|
||
|
|
And currently there are 40 versions available with version one containing 21 modules on
|
||
|
|
the vertical and 21 modules on the horizontal.
|
||
|
|
Each successive version adds another four modules per side, up to version 40, which contains
|
||
|
|
177 modules on the vertical and 177 modules on the horizontal.
|
||
|
|
The higher the version number, the more data that can actually be stored inside the QR code.
|
||
|
|
In addition to data, there's also error correction levels.
|
||
|
|
There are four levels labeled L, which is a 7% correction level, approximately M, which
|
||
|
|
is approximately 15% correction level, Q, which is approximately 25% correction level,
|
||
|
|
and H, which is approximately 30% correction level.
|
||
|
|
These levels define the number of blocks assigned in each module for error correction.
|
||
|
|
The higher the error correction, the less data that can be stored.
|
||
|
|
But the higher the error correction, the more data that can reliably be read in a situation
|
||
|
|
where the QR code becomes dirty or damaged.
|
||
|
|
Now note that this was originally developed by the automotive industry to be used in a factory.
|
||
|
|
So these QR codes could get easily smudged or damaged.
|
||
|
|
So therefore, the higher the error correction level, the less data, but the more reliable
|
||
|
|
it is.
|
||
|
|
At a level L, the lowest level, are typically used in clean room environments where you
|
||
|
|
don't really need to worry about data and damage happening to the QR codes.
|
||
|
|
Levels L, M, and Q are, M is probably pretty standard for just about any use, but Q, if
|
||
|
|
you were going to print your QR codes and put them up on posters around outside, you might
|
||
|
|
want to go with Q, because the QR code could get a little dirty outside.
|
||
|
|
It might get ripped or whatever, but M will suit most purposes.
|
||
|
|
Q, you could do that if you just want a little more error correction, but H should primarily
|
||
|
|
be used in a factory environment where it is dirty and damaged could likely occur.
|
||
|
|
Another factor in QR code is the module size.
|
||
|
|
Now this determines the size of each individual module in millimeters.
|
||
|
|
The larger the module size, the more stable and easier it is to read the QR code, but
|
||
|
|
the larger the actual QR code will be.
|
||
|
|
So you have to balance module size to use.
|
||
|
|
Again, something that would want to be printed on printed media, you might want to have a larger
|
||
|
|
module size as opposed to maybe something you're going to have on your screen.
|
||
|
|
And finally, there is the margin size.
|
||
|
|
You can adjust this, but typically the margin size is a four module wide margin around
|
||
|
|
the symbol.
|
||
|
|
It's a dead area and that's required that that area exists around the symbol so that the
|
||
|
|
scanner knows where the code begins and where it ends.
|
||
|
|
So all those factors into creating a QR code and the amount of data that can be inside
|
||
|
|
the QR code and the resulting size of the QR code.
|
||
|
|
At the lowest error correction at the highest module size, you can have a QR code hold up
|
||
|
|
to 7,089 digits.
|
||
|
|
There are, if you go to the website, there's links at the bottom that break all this down
|
||
|
|
off the Denzo wave website and gives you nice grids on how much data can be held at
|
||
|
|
what version level, at what error correction level.
|
||
|
|
If you're really that interested in finding it out, more than likely that type of information
|
||
|
|
is going to far exceed your uses.
|
||
|
|
Finally, I just want to give a brief mention of something called the micro QR code.
|
||
|
|
These were developed for use in specialized areas like circuit boards where the amount
|
||
|
|
of information or data that needs to be held is small, but the QR size has to be really,
|
||
|
|
really tiny to fit on the circuit board.
|
||
|
|
One of the differences between a micro QR code and a standard QR code is that there's
|
||
|
|
only one position detector pattern.
|
||
|
|
There's a two module wide margin around the QR code and the maximum data capacity is
|
||
|
|
35 numeric characters and that's at the lowest error correction level and only numeric
|
||
|
|
characters.
|
||
|
|
If you get into alpha numeric characters and higher correction levels or binary, the
|
||
|
|
amount of data that can be stored in them drastically reduces.
|
||
|
|
That is QR codes in a nutshell.
|
||
|
|
There's a lot of information there and more than likely you are not going to require
|
||
|
|
that to just start generating your QR codes.
|
||
|
|
Thankfully, QR in code makes it incredibly easy to just dump out whatever it is that you
|
||
|
|
want to do.
|
||
|
|
Now, some practical uses for a QR code would be to embed a URL to a website or a video
|
||
|
|
file into a QR code so that somebody with a smartphone that has a camera could scan
|
||
|
|
that image in with their camera using a barcode application and it would pop up and ask
|
||
|
|
them, what would you like to take this information and go to website if it's a website or if
|
||
|
|
it's a video, would you like to open it on the website or would you like to open it in
|
||
|
|
YouTube or the video application on the phone?
|
||
|
|
If it's a text document, you can actually scan in some text in there.
|
||
|
|
It might ask you if you want to open it in a text editor or a text viewer.
|
||
|
|
You could also encode vCard information into a QR code.
|
||
|
|
When you scan it, it would pop up that information of the vCard and allow it to be entered into
|
||
|
|
the contact information onto the phone.
|
||
|
|
So while there are a myriad of uses and you're left to your own devices to figure that out,
|
||
|
|
QR encode, again, makes it really simple to generate whatever you want to do.
|
||
|
|
QR encode takes some options and whatever string you want to encode.
|
||
|
|
Now the required option you must pass to QR encode is the dash O option, which is the
|
||
|
|
output file name.
|
||
|
|
QR encode generates PNG files and the dash O is going to be whatever the file name is
|
||
|
|
going.
|
||
|
|
You want it to be .png and it will output it whatever string that you pass to it.
|
||
|
|
So for example, if I wanted to create a QR code of the website packerpublicmedia.org,
|
||
|
|
I would just simply type QR code, space dash O, space, hpr.png, http, colon slash slash
|
||
|
|
hackerpublicradio.org, and it would create a nice little QR code with the standard defaults.
|
||
|
|
QR encode does a great job of determining what module version level to use.
|
||
|
|
By default, it uses an error correction level L, which is approximately 7%.
|
||
|
|
Now recall, that is for a clean room environment.
|
||
|
|
And if you're going to be using this to show on a website, chances are that that's good
|
||
|
|
enough.
|
||
|
|
But if you wanted to do the uses on printed media, you might want to go into m or q.
|
||
|
|
So be aware of that.
|
||
|
|
It also does a good job of handling the margin width and the module size.
|
||
|
|
Generally, you won't have to go in and manipulate any of that information.
|
||
|
|
But if you wanted to, you could very easily handle that by passing different options to it.
|
||
|
|
For instance, if you wanted to set the symbol version number, that's what the dash v option.
|
||
|
|
And again, this level is 1 through 40 error correction level is the dash L option standard
|
||
|
|
to 72 dpi.
|
||
|
|
It's good for screen, but you can adjust that with the dash d to create something like 300 dots
|
||
|
|
per inch for code that needs to be printed.
|
||
|
|
Then there's also pixel size for the screen by default.
|
||
|
|
It's three, but you can set that with the option dash s.
|
||
|
|
And finally, margin width, that's the dash m option.
|
||
|
|
And by default, it is four pixels.
|
||
|
|
But otherwise, taking the standard defaults of QR encode will probably produce a QR code
|
||
|
|
to suit your needs right out of the box.
|
||
|
|
And remember, the more data that you're going to put into the QR code, the larger it is
|
||
|
|
going to be, the resulting code will be.
|
||
|
|
So be aware of that.
|
||
|
|
Most of the time, you can just pass a string in there and it will create a QR code based
|
||
|
|
on that string.
|
||
|
|
But I had mentioned that you could put v card information in there.
|
||
|
|
The way to get v card information, or let's say any kind of text file if you had a poem
|
||
|
|
that you wanted to put into a QR code, is quite simple.
|
||
|
|
And you wouldn't want to type it all out on the command line, although you could, you'd
|
||
|
|
want to create that into a file beforehand, a text file, and then redirect that file
|
||
|
|
as standard in, as opposed to typing information out onto the command line, to the QR encode
|
||
|
|
application.
|
||
|
|
Kind of like we discussed last week with on the redirection.
|
||
|
|
So it would be QR encode space dash out would be some file, let's say, Dan's address.
|
||
|
|
And space less than symbol and the v card information, my address, when you do that,
|
||
|
|
it will create a v card QR code that all the information in the QR code is my v card.
|
||
|
|
So if somebody were to scan that with a phone, it would ask if I wanted to input that into
|
||
|
|
their phone as a address or a contact.
|
||
|
|
So it's pretty handy.
|
||
|
|
I hope that this episode has given you a little taste of QR codes and start the juices
|
||
|
|
flowing as to where you could use these and what you could use these for, and you'd
|
||
|
|
be interested in trying out the QR encode application.
|
||
|
|
Head on over to the website linuxintheschel.org and check out entry number one for the full
|
||
|
|
write up and all the links to the documentation and standards for QR codes and the examples
|
||
|
|
over there, watch the video.
|
||
|
|
It's fun stuff and you can produce some really neat QR codes to do love letters or whatever
|
||
|
|
you want to.
|
||
|
|
The sky's the limit with these things.
|
||
|
|
So check it out.
|
||
|
|
Thank you very much for listening and we'll see you in another fortnight.
|
||
|
|
You have been listening to Hacker Public Radio or Hacker Public Radio, those are.
|
||
|
|
We are a community podcast network that releases shows every week day and Monday through Friday.
|
||
|
|
Today's show, like all our shows, was contributed by a HBR listener by yourself.
|
||
|
|
If you ever consider recording a podcast, then visit our website to find out how easy
|
||
|
|
it really is.
|
||
|
|
Hacker Public Radio was founded by the Digital.Pound and the Infonomicom Computer Club.
|
||
|
|
HBR is funded by the binary revolution at binref.com.
|
||
|
|
All binref projects are crowd-responsive by linear pages.
|
||
|
|
From shared hosting to custom private clouds, go to lunarpages.com for all your hosting
|
||
|
|
needs.
|
||
|
|
On list otherwise stasis, today's show is released under a creative comments, attribution,
|
||
|
|
share a like, free dose of license.
|