Generating a QR code does not require a 3rd party service. You can do it yourself. Many online QR code generators or apps on your phone are pathways that force you to paying a monthly fee to keep your generated QR code working. Frustrating.
A QR code seems like magic but really it is just a fancy way of encoding text data in an image that is easy for a computer to read using a camera.
For example, generating a QR code image for the the text string sentence: "DIY QR Codes are easy
" can be done easily on a Linux system (Ubuntu / Raspberry pi OS) by installing a tool called qrencode
:
sudo apt install qrencode
qrencode -o easy-qr.png "DIY QR Codes are easy"
This results in ta PNG image called easy-qr.png
:
Point your phone at that image and out pops the message:
DIY QR code for your website
This means you can make a custom QR code for any website using the URL of the website through the qrencode
command.
For example here is how to make a QR code for the page you are viewing now:
qrencode -o hive-qrcode.png "https://hive.mod0.org/crypt/qr-code-generation/"
Creating the following image:
QR What?
QR is short for 'Quick Response'
Fancy QR Codes via a website:
Don't have a handy Linux environment to use
qrencode
? Not a problem. The open source community has your back with a website to go with a qr-code library: qr-code-styling is a JavaScript library that is made available on a free to use website: qr-code-styling.com.
qr-code-styling.com makes it easy to create QR codes on the web w/o installing any tools and it gives you the ability to tweak generation options to go beyond a black and white QR code.
Here is one I did for t3alliance.org on the website
amzqr (CLI)
There are other open source tools to play with for QR code like amzqr
sudo apt install python3-pip
pip install amzqr
amzqr http://hive.mod0.org
Not that exciting - similar to before but a bit bigger.
Let us spice that up with the following t3logo.png
amzqr https://hive.mod0.org -p t3logo.png -c
That command results in the creation of the following t3logo_qrcode.png
(renamed to hive-t3-qrcode.png
)
Beyond URLs and basic text
Location QR Codes
HowToGeek / Create QR Codes from command line includes examples for how to store location information. Their example is create a QR Code for Stonehenge:
qrencode -s 6 -l H -o "geo.png" "geo:51.185013,-1.859105"
Here is the command for creating a location QR code for the UAF Cornerstone Plaza:
qrencode -s6 -l H -o uaf-geo-qr.png "geo:64.856123,-147.819509"
When scanned and opened with a map app like Google Maps on Android:
I got the lat/lon of the corner stone plaza for that command from latlong.net but you can do that directly in Google Maps. Just zoom into the spot you want on Google Maps and right clicking to see the Lat/Lon in the pop up dialog.
SMS
SMS prompt syntax: "SMSTO:+XX-XXXXXXXXXX:Hi"
VCard
VCard,also known as VCF (Virtual Contact File), is a file format standard for electronic business cards. You make a QR codes to share your contact information.
Create a vcard.txt
file using the following syntax:
BEGIN:VCARD
VERSION:3.0
N:Lastname;Surname;Middle;;
FN:Displayname
ORG:
TITLE:
TEL;TYPE=voice,work,pref:
EMAIL:
END:VCARD
and render it as a QR code like this:
qrencode -s 9 -l H -o "contact_card.png" < vcard.txt
Example for Bugs Bunny's bugs-vcard.txt
BEGIN:VCARD
VERSION:3.0
N:Bunny;George;Washington;Dr;
FN:Bugs Bunny
ORG: Looney Tunes
TEL;TYPE=cell:202-555-0130
TEL;TYPE=work:+1-202-555-0198
EMAIL;TYPE=work:bugs@example.com
END:VCARD
qrencode -o "bugs-vcard.png" < bugs-vcard.txt
WiFi information
The string style to encode WiFi SSID and the password:
"WIFI:S:<SSID>;T:WPA2;P:<password>;;"
Replace the <SSID>
and the <password>
with appropriate details. Swap out WPA2 for WEP as appropriate.
Email prompt
"mailto:<email_address>?subject=Subject&body=Body"
More Learning:
There are lots of other ways. I recommend the following resources to learn more, like getting a free open source GUI (graphical user interface) or other features:
- MakeUseOf.com / Best QR code generator apps for Linux which covers: qrencode (CLI), QR generator (GUI), Decoder (GUI), QtQR (GUI), Zint (CLI & GUI)
- MakeUseOf.com / Create QR Codes in Linux covers many of the examples above in more detail.
Segno (Python)
The Segno tool provides both Python QR Code and Micro QR Code encoders plus a command line tool for generating QR codes similar to qrencode
. Worth checking out if you are a python hacker.
rqrcode (Ruby)
The rqrcode library unleashes Ruby programmers. Used to write dazzler/zerkqr a silly tool that generates ASCII based QR codes in a terminal from an MQTT topic. No need to ask why, just enjoy.