Customizable QR Code Generator
Comprehensive Description of QR Code Pretty: A Customizable QR Code Generator
Introduction
QR Code Pretty is a powerful command-line tool designed to generate visually appealing and highly customizable QR codes. Built upon the robust python-qrcode library, this application allows users to enhance their QR codes with stylistic modifications, color schemes, and even embedded images in the center. Whether for personal use, branding purposes, or professional projects, QR Code Pretty provides a flexible way to create distinctive and engaging barcodes that stand out from generic ones.
This tool is particularly useful for developers, designers, marketers, and anyone needing to generate QR codes with aesthetic appeal while maintaining functionality. Below, we explore its features, installation methods, usage instructions, and customization options in detail.
Core Features of QR Code Pretty
1. Customizable Design Options
QR Code Pretty extends the capabilities of traditional QR code generators by offering several design tweaks:
- Color Scheme Adjustment: Users can modify the colors used in the QR code, including background, foreground (black/white), and border colors.
- Style Enhancements: The tool supports various style parameters such as module thickness, error correction level, and padding adjustments to fine-tune appearance.
- Center Image Integration: Unlike standard QR codes, this application allows embedding an image in the center of the barcode, making it ideal for branding or decorative purposes.
2. Built on Python-QRCode
The underlying library (python-qrcode) ensures high-quality encoding and compatibility with various data types (URLs, text, numbers, etc.). QR Code Pretty leverages this foundation to provide additional customization layers without compromising functionality.
Installation Methods
QR Code Pretty is available for multiple platforms, allowing users to install it via different package managers or build it from source. Below are the installation instructions for various operating systems:
1. NixOS Integration
For users running NixOS, the tool is packaged as a flake input. Installation can be done in two ways:
Option 1: Using Flakes
Add the following to your flake.nix file:
{ pkgs, ... }:
{
inputs = {
qrcode-pretty.url = "github:mrinfinidy/qrcode-pretty";
nixpkgs.follows = "nixpkgs";
};
outputs = { self, inputs }:
let
qrcodePretty = imports.inputs.qrcode-pretty;
in {
packages.x86_64-linux.default = qrcodePretty.packages.x86_64-linux.default;
};
}
Then add qrcode-pretty to your home-manager configuration:
{ config, pkgs, ... }:
{
home.users.${config.home.username}.packages = [
(pkgs.qrcode-pretty.packages.x86_64-linux.default)
];
}
Option 2: Direct Execution
Run the following commands to build and execute the tool:
# Build with Nix
nix build github:mrinfinidy/qrcode-pretty
# Run from local checkout (requires a data input)
nix run .#qrcode-pretty -- -d "your_data_here"
Option 3: Testing Without Installation
For temporary testing:
nix run github:mrinfinidy/qrcode-pretty --override-input nixpkgs nixpkgs
2. Debian/Ubuntu (.deb Package)
Users on Debian-based systems can install QR Code Pretty via the .deb package:
Method 1: Installing from Releases
# Download the latest .deb package
wget https://github.com/mrinfinidy/qrcode-pretty/releases/download/v1.0/qrcode-pretty_1_all.deb
# Install dependencies if needed
sudo apt-get install -f
# Install the package
sudo dpkg -i qrcode-pretty_1_all.deb
Method 2: Building from Source
For those who prefer compiling manually, follow the instructions in the PACKAGING.md file:
dpkg-buildpackage -us -uc -b
sudo dpkg -i ../qrcode-pretty_1_all.deb
3. Arch Linux (AUR)
Arch Linux users can install QR Code Pretty via the AUR:
Using an AUR Helper
# Using yay
yay -S qrcode-pretty
# Using paru
paru -S qrcode-pretty
Manual Installation
Clone the repository and build:
git clone https://aur.archlinux.org/qrcode-pretty.git
cd qrcode-pretty
makepkg -si
4. Using uv (Fast Python Package Manager)
The uv tool is recommended for its speed and reliability over traditional pip. Installation is straightforward:
# Install the tool globally
uv tool install qrcode-pretty
5. Using pipx
For standalone command-line execution, users can install QR Code Pretty via pipx:
pipx install qrcode-pretty
Development Setup
To contribute to or develop QR Code Pretty, users must meet the following requirements:
1. Prerequisites
- Python 3.8 or higher.
- Dependencies:
qrcode[pil] >= 7.0(for image processing).pillow >= 9.0(for advanced image handling).
2. Setting Up the Development Environment
Option 1: Using NixOS
# Clone the repository
git clone https://github.com/mrinfinidy/qrcode-pretty.git
cd qrcode-pretty
# Enter a development shell (Nix)
nix-shell
# Or use flake development mode
nix develop
Option 2: Using uv
# Clone the repository
git clone https://github.com/mrinfinidy/qrcode-pretty.git
cd qrcode-pretty
# Create a virtual environment and install in editable mode
uv venv
# Activate (on Windows)
.\.venv\Scripts\activate
# Install dependencies
uv pip install -e .
# Run the tool
uv run qrcode-pretty --help
Option 3: Using pip + Virtual Environment
# Clone the repository
git clone https://github.com/mrinfinidy/qrcode-pretty.git
cd qrcode-pretty
# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate # Linux/Mac
.\.venv\Scripts\activate # Windows
# Install in editable mode
pip install -e .
3. Building the Package
With Nix
nix build .#qrcode-pretty
The result will be available in ./result/bin/qrcode-pretty --help.
With uv
uv build
Outputs include:
- A wheel file (
dist/qrcode_pretty-1.0.0-py3-none-any.whl) - A source distribution (
dist/qrcode_pretty-1.0.0.tar.gz).
4. Running Tests
Assuming a uv environment is set up, run tests with:
# Install dev dependencies
uv sync --extra dev
# Run pytest
uv run pytest
Usage and Command-Line Options
QR Code Pretty provides a command-line interface (qrcode-pretty) for generating custom QR codes. Below are key usage examples:
1. Basic Usage
Generate a QR code with minimal options:
qrcode-pretty -d "https://github.com/mrinfinidy/qrcode-pretty"
This will produce a standard QR code encoding the provided URL.
2. Command-Line Options
The tool supports several customization parameters:
| Option | Description |
|--------|-------------|
| -h, --help | Display help message and exit. |
| -d, --data | Required: Data to encode in the QR code (URL, text, etc.). |
| -i, --image | Optional: Input image file for embedding in the center of the QR code. |
| -s, --style | Customize style parameters such as module thickness, error correction level, and padding. |
Example with Style Adjustments
qrcode-pretty -d "https://example.com" -s "thickness=3,padding=2"
This modifies the QR code’s appearance by increasing module thickness to 3 and reducing padding to 2.
3. Advanced Customization
Users can further enhance their QR codes with additional parameters:
- Color Scheme: Modify foreground (black/white) and background colors.
- Error Correction Level: Adjust from
L(low) toH(high). - Border Width: Increase or decrease the border thickness.
Example:
qrcode-pretty -d "https://example.com" --foreground-color red --background-color white --border-width 5
Integration with Images
One of the standout features of QR Code Pretty is its ability to embed an image in the center of the QR code. This makes it ideal for branding or decorative purposes.
Example:
qrcode-pretty -d "https://example.com" -i "logo.png"
This generates a QR code with logo.png centered within it, ensuring brand visibility while maintaining functionality.
Conclusion
QR Code Pretty is a versatile and user-friendly tool for generating visually appealing QR codes. Whether you need to customize colors, embed images, or adjust style parameters, this application provides the flexibility required for both personal and professional use cases. With multiple installation options—including NixOS, Debian/Ubuntu, Arch Linux, uv, and pipx—users can easily integrate it into their workflows.
For developers looking to contribute, the tool’s development environment is well-supported via NixOS, uv, or traditional Python setups. Testing and building are straightforward, ensuring a smooth experience for maintaining and expanding the project.
Overall, QR Code Pretty bridges the gap between functional QR codes and artistic design, making it an excellent choice for anyone seeking to create distinctive and engaging barcodes.
Enjoying this project?
Discover more amazing open-source projects on TechLogHub. We curate the best developer tools and projects.
Repository:https://github.com/mrinfinidy/qrcode-pretty
GitHub - mrinfinidy/qrcode-pretty: Customizable QR Code Generator
QR Code Pretty is a powerful command-line tool designed to generate visually appealing and highly customizable QR codes. Built upon the robust python-qrcode lib...
github - mrinfinidy/qrcode-pretty