Table of Contents#
- qrencode (CLI)
- Zint (CLI + GUI)
- Python-qrcode (CLI + Scripting)
- KQRCode (GUI, KDE)
- QR Code Generator (GUI, Flathub)
- libqrencode (Programmatic, for Developers)
- References
1. qrencode (CLI)#
Description#
qrencode is the most popular command-line QR code generator for Linux. Lightweight, fast, and highly customizable, it is ideal for power users, system administrators, and anyone who prefers terminal-based workflows. It supports multiple output formats and advanced customization options like error correction levels and pixel density.
Features#
- Generates QR codes for text, URLs, vCards, and other data types.
- Supports error correction levels (L, M, Q, H) to balance data density and durability.
- Output formats: PNG, EPS, SVG, ANSI (terminal display), and more.
- Customizable size, margin, and color.
- Lightweight (≈100KB binary) with minimal dependencies.
Installation#
Install qrencode on major Linux distributions:
-
Ubuntu/Debian:
sudo apt update && sudo apt install qrencode -
Fedora/RHEL:
sudo dnf install qrencode -
Arch Linux:
sudo pacman -S qrencode
Usage Examples#
Basic QR Code for a URL#
Generate a PNG QR code for https://linux.org and save it as linux_qr.png:
qrencode -o linux_qr.png "https://linux.org" Custom Size and Error Correction#
Create a larger QR code (20px per module) with high error correction (H):
qrencode -s 20 -l H -o large_secure_qr.png "Important data here" Display QR Code in Terminal#
Preview the QR code directly in the terminal (ANSI format):
qrencode -t ANSI "Hello, Linux!" SVG Output for Scalability#
Generate an SVG QR code (scalable vector graphics) for print:
qrencode -t SVG -o contact_qr.svg "BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nTEL:+1234567890\nEND:VCARD" Pros and Cons#
| Pros | Cons |
|---|---|
| Fast and lightweight | No GUI (requires terminal familiarity) |
| Highly customizable | Limited advanced features (e.g., logos) |
| Supports multiple output formats |
2. Zint (CLI + GUI)#
Description#
Zint is a multi-purpose barcode generator that supports QR codes and over 50 other symbologies (e.g., Data Matrix, Aztec, Code 128). It offers both a command-line interface (CLI) and a graphical user interface (GUI), making it suitable for users who need flexibility across workflows.
Features#
- Supports QR codes, Data Matrix, and 50+ other barcode types.
- GUI for point-and-click operation; CLI for scripting/automation.
- Batch processing (generate multiple barcodes from a list).
- Customizable colors, sizes, and error correction.
- Output formats: PNG, BMP, GIF, SVG, PDF.
Installation#
Install Zint (CLI + GUI) on major distributions:
-
Ubuntu/Debian:
sudo apt install zint zint-gui -
Fedora/RHEL:
sudo dnf install zint zint-gui -
Arch Linux:
sudo pacman -S zint
Usage Examples#
CLI: Generate a QR Code#
Create a QR code for Wi-Fi credentials (SSID: MyHomeWiFi, Password: SecurePass123):
zint -b 58 -o wifi_qr.png "WIFI:S:MyHomeWiFi;T:WPA;P:SecurePass123;;" (Note: -b 58 specifies QR code symbology.)
GUI: Launch Zint GUI#
Open the graphical interface:
zint-gui - Enter data (text, URL, etc.) in the "Data" field.
- Select "QR Code" from the "Symbology" dropdown.
- Adjust settings (size, error correction) and click "Generate".
Pros and Cons#
| Pros | Cons |
|---|---|
| Supports 50+ barcode types | GUI is basic (limited advanced options) |
| CLI + GUI options | Heavier than qrencode (due to multi-symbology support) |
| Batch processing |
3. Python-qrcode (CLI + Scripting)#
Description#
python-qrcode is a Python library for generating QR codes, with a built-in CLI for end-users. It is ideal for developers who want to embed QR code generation into Python scripts, as well as users who prefer Python-based tools.
Features#
- Generate QR codes via CLI or Python scripts.
- Customizable colors, logos, and borders.
- Supports error correction, version control, and output formats (PNG, SVG, PIL Image).
- Extensible (add custom plugins for advanced features).
Installation#
Install via Python’s pip (requires Python 3 and Pillow for image processing):
pip install qrcode[pil] # Installs qrcode + Pillow (image library) Usage Examples#
CLI: Basic QR Code#
Generate a QR code for a URL using the qr command:
qr "https://python.org" > python_qr.png Python Script: Embed a Logo#
Add a logo to the center of a QR code (requires Pillow):
import qrcode
from PIL import Image
# Generate base QR code
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_H,
box_size=10,
border=4,
)
qr.add_data("https://linuxhint.com")
qr.make(fit=True)
# Create image and add logo
img = qr.make_image(fill_color="black", back_color="white").convert("RGBA")
logo = Image.open("logo.png").resize((50, 50)) # Replace with your logo
img.paste(logo, (img.size[0]//2 - logo.size[0]//2, img.size[1]//2 - logo.size[1]//2))
img.save("qr_with_logo.png") Pros and Cons#
| Pros | Cons |
|---|---|
| Scriptable (integrate into Python apps) | Slower than native CLI tools (e.g., qrencode) |
| Supports logos and custom colors | Requires Python and Pillow dependency |
4. KQRCode (GUI, KDE)#
Description#
KQRCode is a lightweight GUI QR code generator designed for the KDE desktop environment. It integrates seamlessly with KDE’s design language (Plasma) and offers a simple interface for quick QR code creation.
Features#
- User-friendly KDE-style interface.
- Supports text, URLs, vCards, and Wi-Fi credentials.
- Real-time preview (see changes as you type).
- Customizable size, error correction, and output format (PNG, SVG).
- Lightweight (≈500KB installed size).
Installation#
KQRCode is pre-installed on many KDE-based distributions (e.g., Kubuntu, openSUSE KDE). For others:
-
Ubuntu/Debian (KDE):
sudo apt install kqrencode -
Fedora (KDE):
sudo dnf install kqrencode -
Arch Linux (KDE):
sudo pacman -S kqrencode
Usage#
- Launch KQRCode from the KDE menu (search for "QR Code Generator").
- Select a data type (e.g., "Text", "URL", "Wi-Fi").
- Enter your data (e.g.,
https://kde.org). - Adjust settings (size, error correction) using the sidebar.
- Click "Save" to export as PNG or SVG.
Pros and Cons#
| Pros | Cons |
|---|---|
| Integrates with KDE Plasma | Limited to KDE (not ideal for GNOME/Xfce) |
| Real-time preview | Fewer features than CLI tools |
| Simple, intuitive interface |
5. QR Code Generator (GUI, Flathub)#
Description#
QR Code Generator (by Martin Rotter) is a cross-desktop GUI app available on Flathub. It offers a modern interface with support for advanced features like logo embedding and custom color schemes, making it ideal for users who prefer a graphical tool without KDE dependencies.
Features#
- Supports text, URLs, vCards, Wi-Fi, and event (iCalendar) QR codes.
- Embed logos in QR codes (with transparency support).
- Customize foreground/background colors.
- Error correction levels (L, M, Q, H).
- Output formats: PNG, JPEG, SVG.
Installation#
Install via Flatpak (ensure Flatpak is enabled on your system):
flatpak install flathub com.github.martinrotter.qrcodegenerator Usage#
- Launch the app from your desktop menu (search for "QR Code Generator").
- Select a data type (e.g., "URL") and enter your content.
- Click "Advanced" to adjust colors, add a logo, or change error correction.
- Preview the QR code and click "Save" to export.
Pros and Cons#
| Pros | Cons |
|---|---|
| Cross-desktop (works on GNOME, Xfce, etc.) | Requires Flatpak (may use more storage) |
| Logo embedding and color customization | Limited updates compared to native packages |
6. libqrencode (Programmatic, for Developers)#
Description#
libqrencode is a low-level C library for generating QR codes programmatically. It is the backend for tools like qrencode and is ideal for developers building QR code functionality into C/C++ applications.
Features#
- C API for direct integration into applications.
- Supports all QR code versions (1–40) and error correction levels.
- Generates raw QR code matrices (bitmaps) for custom rendering.
- Lightweight (≈200KB library size).
Installation#
Install the development package for libqrencode:
-
Ubuntu/Debian:
sudo apt install libqrencode-dev -
Fedora/RHEL:
sudo dnf install libqrencode-devel -
Arch Linux:
sudo pacman -S libqrencode
Usage Example (C Code)#
Generate a QR code and save it as a PNG using libqrencode and libpng:
#include <qrencode.h>
#include <png.h>
#include <stdio.h>
void generate_qr(const char *data, const char *filename) {
QRcode *qrcode = QRcode_encodeString(data, 0, QR_ECLEVEL_M, QR_MODE_8, 1);
if (!qrcode) {
fprintf(stderr, "Failed to generate QR code\n");
return;
}
// Write PNG (simplified example; error handling omitted for brevity)
FILE *fp = fopen(filename, "wb");
png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
png_infop info = png_create_info_struct(png);
png_init_io(png, fp);
png_set_IHDR(png, info, qrcode->width, qrcode->width, 8, PNG_COLOR_TYPE_GRAY, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
png_write_info(png, info);
png_bytep row = malloc(qrcode->width);
for (int y = 0; y < qrcode->width; y++) {
for (int x = 0; x < qrcode->width; x++) {
row[x] = qrcode->data[y * qrcode->width + x] ? 0 : 255; // Black/white
}
png_write_row(png, row);
}
png_write_end(png, NULL);
free(row);
fclose(fp);
QRcode_free(qrcode);
}
int main() {
generate_qr("https://developers.libqrencode.org", "dev_qr.png");
return 0;
} Compile with:
gcc -o qr_example qr_example.c -lqrencode -lpng Pros and Cons#
| Pros | Cons |
|---|---|
| Programmatic control for developers | Requires C/C++ knowledge |
| Lightweight and fast | No built-in output rendering (needs additional libraries like libpng) |
7. References#
- qrencode: Official Website
- Zint: Zint Barcode Generator
- Python-qrcode: GitHub Repository
- KQRCode: KDE Apps
- QR Code Generator (Flathub): Flathub Page
- libqrencode: GitHub Repository
Whether you’re a terminal enthusiast, a GUI user, or a developer, Linux offers a QR code generator to suit your needs. For quick CLI tasks, qrencode is unbeatable. For GUI users, KQRCode (KDE) or the Flathub app are great choices. Developers can leverage python-qrcode or libqrencode for programmatic control. Choose the tool that aligns with your workflow and start generating QR codes effortlessly!