https://github.com/devluxor/qr-generator
A QR Code generator written in Python 🐍
https://github.com/devluxor/qr-generator
Last synced: 2 months ago
JSON representation
A QR Code generator written in Python 🐍
- Host: GitHub
- URL: https://github.com/devluxor/qr-generator
- Owner: devluxor
- Created: 2024-12-24T11:09:28.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-12-24T11:53:56.000Z (4 months ago)
- Last Synced: 2025-01-01T13:15:02.258Z (4 months ago)
- Language: Python
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# QR Code Generator
This is a simple Python program for generating QR codes using the `qrcode` library. Users can customize the size, padding, and colors of the QR code and save it as an image file.
## Features
- Accepts user input to encode in the QR code.
- Allows customization of QR code size, padding, and colors.
- Saves the QR code image in PNG format.
- Provides default configurations for ease of use.## Prerequisites
- Python 3.x installed.
- `qrcode` library installed.
- `Pillow` library installed.### Install Required Library
```bash
pip install qrcode Pillow
```## Usage
1. Clone this repository or download the script.
2. Run the script using the following command:```bash
python main.py
```3. Enter the text you want to encode in the QR code when prompted.
4. The QR code image will be saved as `sample.png` in the same directory.## Configuration
You can modify the following default settings in the code:
- **Size**: Controls the size of each box in the QR code grid. Default is `30`.
- **Padding**: Sets the border thickness around the QR code. Default is `2`.
- **Foreground Color**: The color of the QR code itself. Default is `#000` (black).
- **Background Color**: The color of the QR code background. Default is `#FFF` (white).Example to change default configurations:
```python
DEFAULT_SIZE = 40
DEFAULT_PADDING = 4
DEFAULT_FG_COLOR = '#FF0000' # Red
DEFAULT_BG_COLOR = '#00FF00' # Green
```## Error Handling
The program includes error handling for common issues such as:
- Invalid input data.
- File I/O errors when saving the QR code image.## Example Output
After running the script, a sample QR code image will be created in the directory with the name `sample.png`.