How can I create QR codes in Ubuntu 16.04?
-
4Of what do you want to create a QR code? A URL? Arbitrary text or binary data? Please [edit] your question to clarify what you want to achieve. – David Foerster Sep 25 '17 at 10:39
-
2https://apps.ubuntu.com/cat/applications/qreator/ and http://www.omgubuntu.co.uk/2011/03/how-to-create-qr-codes-in-ubuntu and http://ubuntuhandbook.org/index.php/2013/11/qtqr-graphical-create-read-qr-codes-ubuntu/ – Rinzwind Sep 25 '17 at 10:40
-
@Rinzwind: That looks almost like an answer to me. – David Foerster Sep 25 '17 at 10:41
-
2@Rinzwind That is about reading a QR, not creating one. Also, did you test `qreator`? It seems utterly broken to me. – Byte Commander Sep 25 '17 at 10:42
-
We have been using qrencode for what 5 years or so ;) – Rinzwind Sep 25 '17 at 10:43
-
1@Rinzwind Yep, `qrencode` works fine for me. `qreator` is unusable. – Byte Commander Sep 25 '17 at 10:44
3 Answers
I have tested two applications that worked well on Ubuntu 16.04 for creating QR codes:
If you want a simple command-line tool, I can recommend
qrencode.It takes an output file name and optionally an input string as command-line arguments and produces a PNG file with the QR code. If no input string is given as argument, it reads from standard input, so you can either type into the terminal or pipe another command's output into it. There are also some more advanced options.
Install it with
sudo apt install qrencode.The basic usage is
qrencode -o "output-file.png" "Your text here".
For more information seeman qrencode.
If you want a user-friendly GUI tool, you should try
qtqr.It offers you a clean user interface that allows you to select an input data type like e.g. URL, email address, phone number, WiFi credentials or plain text. You can easily select the pixel size, margin and error correction level and save in the formats PNG and SVG. It also allows you to scan and decode QR codes from image files or a webcam.
Install it with
sudo apt install qtqr.
Now here's a screenshot showing how to create a QR code of my Ask Ubuntu profile URL with both tools (and using eog on the right to view the image created by qrencode, as it has no preview). Note that the created images are absolutely identical:
- 105,631
- 46
- 284
- 425
-
1A variant of `qrencode` which can be quite useful: `qrencode -o- "your text here" | display -` (create QR code for "your text here" and display it with ImageMagick on screen, close by pressing `Escape`). To create a larger size, specify the `-s
` option as in: `qrencode -s8 -o- "your text here" | display -`. Create something from your clipboard: `xsel -b | qrencode -o- | display -` – Lekensteyn Sep 26 '17 at 01:56 -
Do not use **qtqr** unless you want to wast a couple of hours trying to figure out, why generated QR code contains corrupted text – user502144 Jun 12 '19 at 11:06
Using Scribus
- Install and open Scribus
- In new Document dialog select Single Page

- From Insert menu at top choose Barcode

- Select QR Code from Type dropdown (You can expand this window if it is too small)

- Type in the text you want to encode in the Code input box

- Press OK and click to place a 'frame' which is Scribus-speak for an
element on a page

- Resize the 'frame' as you want it

- Export the page as an image from File>Export>Save as Image...

- Crop the image in an image editor
- 157
- 7
-
3That is surely nice if someone already uses Scribus and ideally can continue working with the QR code in that application, but for exclusively generating simple QR codes, I would probably not use it. It's a bit like recommending LibreOffice Writer for cropping images... – Byte Commander Sep 26 '17 at 11:41
-
lol, true, personally I was a little stumped to find that functionality existed and I had Scribus lying around since forever, thought maybe someone else might be in the same boat. – groundjet Sep 26 '17 at 18:06
-
It's a bit like using a hammer instead of a screwdriver when you have to simply tighten a loose screw. – Muhammad bin Yusrat Feb 20 '18 at 11:16
This also works in Ubuntu 18.04+.
To expound upon the qrencode answer here: to generate an auto-deleting QR code, so you can just view it once, do this:
# 1. 1-line cmd to make a QR code from a URL
qrencode -m 4 -o /tmp/qr.png "www.google.com" \
&& ((eog /tmp/qr.png &); sleep 1; rm /tmp/qr.png)
# 2. 1-line cmd to make a QR code from an entire file
cat "path/to/file.txt" | qrencode -m 4 -o /tmp/qr.png \
&& ((eog /tmp/qr.png &); sleep 1; rm /tmp/qr.png)
For full details, see my answer here: Stack Overflow: piping qrencode to eog to avoid creating a file
- 8,025
- 7
- 66
- 105
