Creating a QR code with zint

Last edited: 6th May 2026

Ever seen a QR code?

QR codes are these little pieces of gibberish which normies can scan on their smartphone to for example receive a link to a website or to connect to the WiFi right away.

Now, how do you actually create one?

This is a question I asked myself as well. While I do not create QR codes on a daily basis, it would be still nice to know how to create one, and I stumbled on zint, a command line barcode generator allowing you to create a QR code as well.

By default, like many command-line interface tools, it does nothing but bombard you with a list of all options zint can offer. These are the essentials for creating a QR code:

$ zint -d "Some text"

The -d flag is the one to insert the text in that is desired to contain inside a QR code. This command will create a file called out.png, which can be changed with the -o flag. Instead of simply inserting text, the -i flag can be used to take text from an input file:

$ zint -i ~/Documents/link.txt -o ~/Pictures/qr_code.png

Opening this image clearly shows an issue: It is not a QR code. This is because zint is not a QR code generator by default, instead it is a barcode generator that can also create QR codes. For this, the barcode type has to specificed. These can be found with the following command:

$ zint -t

There are a couple of different QR codes, but the most common one is the regular QR code with the number 58 in zint:

$ zint -b 58 -d "Hello, world!" -o ~/Pictures/output.png

Now, this does look like a QR code indeed; just a bit smaller than usual. However, it is also quite blurry, which can be fixed with scaling it to a higher resolution:

$ zint -b 58 --scalexdimdp=1 -d "Hello, world!" -o ~/Pictures/output.png

1 should be enough for it to not look too blurry. Also, if desired, the QR code version can make it look like commonly seen QR codes and also allows for more information to be inserted into a QR code:

$ zint -b 58 --vers=4 --scalexdimdp=1 -d ~/Documents/bee_movie_script.txt -o ~/Pictures/output.png

For QR codes, the maximum is 40, but most QR codes are either 3 or 4.

This should be enough for say inserting it inside a text document, but simply just the QR code might not look too nice since it does not have any whitespace bordering the QR code. These can be simply added with the --whitesp= --vwhitesp= flags. Personally, 5 looks good enough:

$ zint -b 58 --whitesp=5 --vwhitesp=5 --vers=4 --scalexdimdp=1 -d "2024 sucked"

If a text or data input contains non-latin characters, there will be a good chance it will throw an error. A simple fix is just to use UTF-8 instead of whatever zint uses by default with the ECI flag:

$ zint -b 58 --whitesp=5 --vwhitesp=5 --vers=4 --eci=26 --scalexdimdp=1 -d "ΔEN(O-H) = 1.4" -o hydroxide_electronegativity.png

Different ECI codes can be found with the -e flag:

$ zint -e

Now you know how to create a QR code! Make sure to share this blog post with a QR code created with this command:

$ zint -b 58 --whitesp=5 --vwhitesp=5 --vers=4 --scalexdimdp=1 -d "https://sprinklednights.codeberg.page/blog/creating-a-qr-code-with-zint.html" -o cool_blogpost.png