Linux generate qr code

QR Code Generator – Windows, Linux, MacOS

A QR code generator is an application which creates and stores different types of data in a QR code image file.

A qrencode is a free command line tool for encoding string data in the QR code and saving it as a PNG or an EPS image.

In this note i will show how to install and and how to use (with examples) the qrencode on Windows, Linux and MacOS from the command line.

Cool Tip: How to open a File Explorer from a Windows command prompt (CMD) or PowerShell ! Read more →

QR Code Generator

Install on Window

The qrencode for Windows doesn’t actually require installation – simply download the latest version of the QR code generator, extract the qrencode.exe and open a command prompt in that folder.

To open the command prompt, press the ⊞ Win + R shortcut to open the “Run” dialog, type in cmd and click “OK”, then navigate to the folder with the qrencode.exe , e.g.:

C:\Users\MyName> cd Downloads\QREncode-4.1.1_Win32 C:\Users\MyName\Downloads\QREncode-4.1.1_Win32> qrencode -V qrencode version 4.1.1 Copyright (C) 2006-2017 Kentaro Fukuchi 

Cool Tip: How to open a Windows command prompt (CMD) or PowerShell withing the current folder from a File Explorer! Read more →

Install on Linux & MacOS

To install the qrencode on Linux or MacOS:

# Linux $ sudo apt install qrencode # MacOS $ brew install qrencode

Basic Usage of QR Code Generator

To generate a QR code from a command line use the following format:

$ qrencode -o filename> "data>" - example - $ qrencode -o qrcode.png "Some text"

By default, qrencode saves the generated QR code in a PNG format, but you can specify the type of the generated image using the -t or —type= options, e.g:

$ qrencode -t EPS -o qrcode.eps "Some text" $ qrencode --type=ASCII -o qrcode.txt "Some text"
PNG (default), PNG32, EPS, SVG, XPM, ANSI, ANSI256, ASCII, ASCIIi, UTF8, ANSIUTF8

You can also play with a size, width of the boarders and error tolerance of the QR code. e.g:

$ qrencode -s 3 -l L -m 4 -o qrcode.png "Some text"
Option Description
-s NUMBER , —size=NUMBER Specify module size in dots (pixels). Default 3 .
-l , —level=

Specify error correction level from L (lowest) to H (highest). Default L .
-m NUMBER , —margin=NUMBER Specify the width of the margins. Default 4 .

To change a foreground/background color of the generated QR code, set them in a hexadecimal notation using the correspondent options:

$ qrencode --foreground color:#4285F4;">4285F4" --background background-color:#FFFFFF;">FFFFFF" -o qrcode.png 'Some text'

QR Code Generation Examples

You can generate QR codes that will trigger different actions when scanned by a smartphone, for example:

# Display a text $ qrencode -o qrcode.png "Some text" # Open a location on a map $ qrencode -o qrcode.png "geo:37.234332396,-115.80666344" # Make a phone call $ qrencode -o qrcode.png "tel:0123456789" # Open an URL $ qrencode -o qrcode.png "https://www.shellhacks.com" # Send an email $ qrencode -o qrcode.png "mailto:no_reply@shellhacks.com?subject=Hey&body=What's up?" # Send an SMS message $ qrencode -o qrcode.png "smsto:0123456789,The text of the SMS message." # Connect to a Wi-Fi network $ qrencode -o qrcode.png "WIFI:T:WPA2;S:box-12345;P:pa$$w0rd;;"

Cool Tip: How to open a File Manager from a terminal in Linux! Read more →

To add a contact using the QR code, create a file called contact.txt with a vCard data:

BEGIN:VCARD VERSION:4.0 UID:urn:uuid:4fbe8971-0bc3-424c-9c26-36c3e1eff6b1 FN;PID=1.1:J. Doe N:Doe;J.;;; EMAIL;PID=1.1:jdoe@example.com CLIENTPIDMAP:1;urn:uuid:53e374d9-337e-4727-8803-a1e9c14e0556 END:VCARD

… and pass this file to the QR code generator as follows:

To trigger a creation of the event in a calendar, use the similar method, i.e. create a file called event.txt with a vEvent data:

BEGIN:VCALENDAR VERSION:2.0 PRODID:-//hacksw/handcal//NONSGML v1.0//EN BEGIN:VEVENT UID:19970610T172345Z-AF23B2@example.com DTSTAMP:19970610T172345Z DTSTART:19970714T170000Z DTEND:19970715T040000Z SUMMARY:Bastille Day Party END:VEVENT END:VCALENDAR

. and redirect this file to the QR code generator:

Источник

Генерируем QR-коды в терминале Linux Mint и Manjaro Linux

Популярность QR-кодов в России выросла благодаря эпидемии коронавируса, когда для входа в любое общественное место нужно было иметь этот черно-белый квадратик. Но и после того, как болезнь чудесным образом исчезла из заголовков СМИ, использование QR-кодов не сошло на нет и сейчас, например, в крупных супермаркетах можно оплатить покупку по QR-коду, отсканировав его в банковском приложений.

Может показаться, что обычному человеку эти коды генерировать и использовать не нужно, но оказывается, что вариантов их применения огромное количество. Например, будучи еще учителем, я использовал их для того, чтобы раздавать детям онлайн-тесты, став автором на Дзене я первое время вставлял QR-код со ссылкой на канал в превью постов, оставаясь репетитором использую их для того, чтобы делиться ссылками на интересные материалы по истории и обществознанию. После полного перехода на Linux я обзавелся программой для генерации QR-кодов, которая была всегда под рукой для случая, когда такая генерация понадобится. Называлась она Qreator и относительно недавно перестала корректно работать. В поисках замены я нашел консольную утилиту Qrencode, которую использую до сих пор и про которую хочу рассказать вам.

Qreator и Qrencode — одного поля ягоды

Оказывается, что утилита, которую использовал ранее и которую использую сейчас основаны на одних и тех же инструментах: язык программирования Python и модуль к нему, который генерирует QR-код. Только в случае Qreator надстройкой над Python была графическая библиотека QT5, которая предоставляла пользовательский интерфейс. В Qrencode никакой надстройки нет, потому устанавливается и работает она намного шустрее.

Установка Qrencode

Под рукой у меня как всегда Manjaro Linux в качестве основного дистрибутива и Linux Mint 21 на виртуальной машине. На их примере покажу, как установить программу.

В Linux Mint достаточно открыть Менеджер программ и в поиск ввести название программы.

Источник

How to Easily Create QR Codes on Linux

There are a lot of ways to generate QR codes on Linux. But if you want to create QR codes quickly, using the qrencode utility is the optimal choice.

scanning qr code generated on linux

Readers like you help support MUO. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.

A QR code is a type of barcode that stores information and is read using a digital device, including smartphones. If you’ve been to convenience stores or cafés, you’d have probably seen QR codes there for receiving payments or sharing Wi-Fi passwords, among other things.

But that’s not all. QR codes have other useful applications in today’s world. For instance, you can use QR codes to share access to your home Wi-Fi with guests or to share your contact card.

Follow along as we explain how to create QR codes on Linux using qrencode.

Step 1: Installing qrencode on Linux

First up, you need to install the qrencode program on your computer. Just like any other program, doing this on your Linux machine depends entirely on the Linux distro you’re using. So follow the steps listed below accordingly to get qrencode on your system:

On Ubuntu and its derivatives, open the terminal and run the following command to install qrencode:

sudo apt install qrencode 

To install qrencode on Fedora, use:

sudo dnf install qrencode 

On Arch Linux and Manjaro, you can install qrencode with Pacman, like this:

sudo zypper install qrencode 

Step 2: Using qrencode to Create a QR Code

Being a CLI-based tool, qrencode involves the use of a bunch of different options to generate a QR code. The following are all the essential options (and their attributes) you need to know to generate a basic QR code:

  • -o filename: Used to specify the output file name of the generated QR code.
  • -s size: It allows you to specify the module size in dots. By default, its value is set to three, but you can change it based on your requirements.
  • -l error_correction_level: As its name suggests, this option allows you to set the error correction level for your QR code. Basically, it decides how much change in the QR code affects its scannability. It uses low (L) by default.
  • -t filetype: This option lets you decide the file type for your QR code. Its default value is PNG, but you can set it to a range of other formats.

For more qrencode options, run the following command in a terminal window:

qrencode options

Now that you’re familiar with basic qrencode options, here’s how to put them together into a command to generate a QR code that outputs text:

qrencode -s 9 -l H -o "QR-code.png" "This is a test QR code!" 

With this command, we’re generating a QR code for the text «This is a test QR code!». This QR code will be called QR-code.png, have a size of nine pixels, and use the high (H) correction level. It’ll be saved to the home directory on your computer, so you can use the built-in file manager to access it.

Step 3: Verifying the Generated QR Code

After you’ve created the QR code, the next step is to verify if it was generated properly and contains your desired information.

To do this, all you need is a QR code scanner. On iPhone, you get a QR scanner as a built-in utility, which you can access from the Control Center. On the other hand, if you’re on Android, you can download the QR Code Reader and Scanner by Kaspersky on your device. Or you can download any other QR code scanner from the Play Store.

Next, open the QR code image on your Linux desktop. Fire up the QR code scanner on your smartphone and point it to the QR code on your computer such that it aligns properly inside the box.

Once your phone scans this code, it will display its content. Verify if it’s the same content you put in during code generation. In case it’s the same, you’re good to go and can use this QR code as you desire. If not, try generating it again using qrencode.

Encoding Other Kinds of Data in a QR Code

As shown a couple of steps earlier, text is one of the many kinds of data you can encode into your QR code. Besides text, you can also include a website URL, SMS or email link to your phone number or email address, contact card, app download links, or calendar event, among other things.

Below we’ve listed the commands to generate QR codes with a few of these elements:

1. Generating a QR Code With a Website URL

qrencode -s 9 -l H -o "URL.png" "https://www.makeuseof.com" 

2. Adding an SMS Prompt to a QR Code

qrencode -s 9 -l H -o "SMS.png" "SMSTO:+XX-XXXXXXXXXX:Hi" 

When you scan this QR code using your phone, it will prompt you to send the message or compose a new one inside the messaging app. Selecting the former will send a «Hi» message to that number, whereas the latter will give you the option to edit the message before sending it.

Источник

Читайте также:  Разбить диск linux fdisk
Оцените статью
Adblock
detector