Skip to content

A modern, customizable QR code generator built with Python and Streamlit. Supports gradients, custom colors, background images, and real-time previews. Perfect for branding, marketing, and creative use cases.

Notifications You must be signed in to change notification settings

M-Husnain-Ali/QR_Code_Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🎨 Fancy QR Code Generator

Language Framework Platform License

A sophisticated Python web application that generates customizable and visually appealing QR codes. This project combines functionality with aesthetics, allowing users to create unique QR codes with custom colors, backgrounds, and gradient effects.

Author: Muhammad Husnain Ali
Repository: QR_Code_Generator

📋 Table of Contents

🎯 Overview

This Fancy QR Code Generator is a web-based application that elevates the standard QR code creation process by adding customization options and visual enhancements. Built with Python and Streamlit, it offers an intuitive interface for creating visually striking QR codes suitable for business and personal use.

Core Features

  • Custom Colors: Choose custom colors for QR code and background
  • Background Images: Add custom background images to QR codes
  • Gradient Effects: Apply gradient overlays for unique visual effects
  • Real-time Preview: Instant visualization of QR code changes
  • High Quality Output: Generate high-resolution QR codes suitable for print and digital use

💻 Requirements

  • Python 3.7 or later
  • Streamlit
  • qrcode
  • Pillow (PIL)
  • numpy
  • Web browser with modern features support

🚀 Installation & Setup

  1. Clone the Repository

    git clone https://github.com/M-Husnain-Ali/QR_Code_Generator.git
    cd QR_Code_Generator
  2. Set Up Virtual Environment

    # Windows
    python -m venv venv
    .\venv\Scripts\activate
    
    # Linux/macOS
    python3 -m venv venv
    source venv/bin/activate
  3. Install Dependencies

    # Install all required packages from requirements.txt
    pip install -r requirements.txt

    Dependencies included:

    • streamlit - Web application framework
    • qrcode - QR code generation library
    • Pillow - Image processing library
    • numpy - Numerical computing library
  4. Run the Application

    streamlit run qrscanner.py
  5. Deactivate Virtual Environment When Done

    deactivate

✨ Features

🎨 Customization Options

  • Color Selection

    • Custom QR code colors with color picker
    • Custom background colors with color picker
    • Default black QR code on white background
    • Gradient overlay effects for modern look
  • Background Options

    • Solid color backgrounds
    • Custom image backgrounds (supports jpg, jpeg, png)
    • Semi-transparent QR code overlay (128 alpha)
    • Background image size auto-adjustment

🛠️ Technical Features

  • Error correction (Level M) for reliable scanning
  • Automatic size optimization (version 1 QR code)
  • 10x10 box size for clear visibility
  • 4-unit border for proper scanning
  • High-resolution PNG output
  • Real-time preview generation
  • Gradient alpha compositing

💫 User Interface

  • Intuitive color pickers for QR and background
  • Simple file upload system for backgrounds
  • Live preview updates
  • Responsive design with custom CSS
  • User-friendly controls and warnings
  • Modern pink-themed UI elements

🏗️ Technical Details

Implementation Architecture

Application
├── User Interface (Streamlit)
│   ├── Input Components
│   │   ├── Text Input
│   │   ├── Color Pickers
│   │   ├── Background Selector
│   │   └── File Uploader
│   └── Output Components
│       ├── QR Code Display
│       └── Warning Messages
├── QR Generation (qrcode)
│   ├── Data Encoding
│   ├── Error Correction
│   └── Size Optimization
└── Image Processing (PIL)
    ├── Background Integration
    ├── Transparency Control
    └── Gradient Effects

Key Components

  1. QR Code Generation (generate_fancy_qr_code)

    def generate_fancy_qr_code(data, color, background_color, background_image, gradient_colors):
        # Generates QR code with customization options
        # Parameters:
        # - data: String to encode
        # - color: QR code color (hex)
        # - background_color: Background color (hex)
        # - background_image: Optional PIL Image
        # - gradient_colors: Boolean for gradient effect
    • Version control (version=1)
    • Error correction (ERROR_CORRECT_M)
    • Size optimization (box_size=10, border=4)
    • Custom color support
    • Background image integration
    • Gradient effect processing
  2. Image Processing

    • Background image handling
    • RGBA color space conversion
    • Alpha channel manipulation
    • Gradient overlay generation
    • Image composition and blending
    • PNG format output generation
  3. User Interface

    • Custom CSS styling
    • Input validation
    • Real-time updates
    • Error handling
    • Preview generation
    • Responsive layout

🎮 Usage

  1. Launch the Application

    • Activate virtual environment
    • Run Streamlit server
    • Access via web browser
    • Note the custom page title and icon
  2. Create QR Code

    • Enter URL or text data
    • Select QR code color using picker
    • Choose background style:
      • Plain color with picker
      • Upload custom image
    • Toggle gradient effect if desired
  3. Customize Appearance

    • Use color pickers for precise colors
    • Upload background image (jpg/jpeg/png)
    • Enable gradient for modern look
    • Preview changes in real-time
  4. Generate and Save

    • Click "Generate Fancy QR Code"
    • View preview with auto-width
    • Save generated PNG file
    • Test QR code with scanner

📁 File Structure

QR_Code_Generator/
├── qrscanner.py          # Main application file
├── requirements.txt      # Project dependencies
├── .gitignore           # Git ignore configuration
└── README.md            # Project documentation

File Descriptions

  1. qrscanner.py

    • Main application logic
    • QR code generation functions
    • Streamlit UI implementation
    • Image processing utilities
  2. requirements.txt

    • Project dependencies
    • Required Python packages
    • Version specifications
    • Easy installation via pip
  3. .gitignore

    • Git version control configuration
    • Ignores Python build files
    • Excludes virtual environment
    • Ignores IDE-specific files
    • Prevents committing generated QR codes
    • Excludes system and cache files
  4. README.md

    • Project documentation
    • Installation instructions
    • Usage guidelines
    • Feature documentation
    • Technical details

🤝 Contributing

Contributions are welcome! Here are some ways you can contribute:

  1. Improve the UI

    • Add more color themes
    • Implement new gradient styles
    • Enhance mobile responsiveness
  2. Add Features

    • Support for more QR code versions
    • Additional error correction levels
    • More background effects
    • Export in different formats
  3. Code Quality

    • Add unit tests
    • Improve error handling
    • Optimize image processing
    • Add type hints
  4. Documentation

    • Add code comments
    • Improve README
    • Create user guide
    • Add API documentation

Made with ❤️ by Muhammad Husnain Ali

About

A modern, customizable QR code generator built with Python and Streamlit. Supports gradients, custom colors, background images, and real-time previews. Perfect for branding, marketing, and creative use cases.

Topics

Resources

Stars

Watchers

Forks

Languages