A simple and efficient command-line tool to generate QR codes from text or URLs using Python.
- Generate QR codes from any text or URL
- Customizable size and border settings
- Auto-generated filenames or custom output names
- Clean command-line interface
- Cross-platform compatibility
-
Clone the repository:
git clone https://github.com/YOUR_USERNAME/qr-code-generator.git cd qr-code-generator -
(Recommended) Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # for macOS/Linux .\venv\Scripts\activate # for Windows
-
Install requirements:
pip install -r requirements.txt
You can run the tool from the command line with the python generate_qr.py command.
Basic Usage:
python generate_qr.py "https://www.google.com"Advanced Usage:
# Custom output filename
python generate_qr.py "Hello World" --output hello.png
# Custom size and border
python generate_qr.py "Contact Info" --size 15 --border 2
# Full example with all options
python generate_qr.py "https://github.com" -o github_qr.png -s 12 -b 3| Option | Short | Description | Default |
|---|---|---|---|
--output |
-o |
Output filename | Auto-generated |
--size |
-s |
Size of each box in pixels | 10 |
--border |
-b |
Border size in boxes | 4 |
--help |
-h |
Show help message | - |
- QR codes are saved as PNG images
- Default filename format:
[first_20_chars]_qr.png - Files are saved in the current directory
- Python 3.6+
- qrcode library with PIL support
- Pillow (PIL) for image processing
Generate a QR code for a website:
python generate_qr.py "https://www.example.com"
# Output: https___www_example_com_qr.pngCreate a QR code with custom settings:
python generate_qr.py "WiFi Password: MySecretPass" -o wifi_qr.png -s 8 -b 2
# Output: wifi_qr.png- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is open source and available under the MIT License.
If you encounter any issues or have suggestions, please open an issue on GitHub.