Skip to content

A simple Python script that takes a URL from the user, generates a QR code using the qrcode library, and saves it as a PNG file with the user’s chosen filename. Automatically appends .png if missing.

License

Notifications You must be signed in to change notification settings

Rrishitt/QR-Code-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

QR Code Generator (Python)

A minimal command-line tool that converts any URL into a QR code image. The script uses the qrcode Python library to generate the QR and saves it as a PNG file with a user-specified filename.


Features

  • Converts any URL into a QR code.
  • Saves output as a PNG file.
  • Automatically adds .png if the user doesn’t include it.
  • Simple, clean, and beginner-friendly.

How It Works

  1. Prompts the user for:

    • A URL
    • The file name to save the QR code
  2. Ensures the filename ends with .png:

    if not(filename.endswith(".png")):
        filename += ".png"
  3. Generates the QR using:

    img = qrcode.make(url)
  4. Saves the image to disk:

    img.save(filename)

Installation

Install the QR code library:

pip install qrcode[pil]

Usage

Run the script:

python main.py

Example interaction:

Enter your url: https://example.com
Filename you want to save it as: myqr

Output generated:

myqr.png

Requirements

  • Python 3.x
  • qrcode library
  • Pillow (installed automatically with qrcode[pil])

About

A simple Python script that takes a URL from the user, generates a QR code using the qrcode library, and saves it as a PNG file with the user’s chosen filename. Automatically appends .png if missing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages