Convert any file into a series of QR codes for transmission via photos, then reconstruct the original file from the QR code images. Perfect for air-gapped systems, conference presentations, or creative file sharing.
# Install required packages
pip install qrcode[pil] pyzbar opencv-python
# If you encounter issues with pyzbar on Windows, also try:
pip install pyzbar[scripts]# Convert a file to QR codes with default settings (safe, reliable)
python qr_transmitter.py encode myfile.py
# Encode with larger chunks (fewer QR codes, but harder to scan)
python qr_transmitter.py encode myfile.py -c 2500
# Encode with smaller chunks (more QR codes, but easier to scan)
python qr_transmitter.py encode myfile.py -c 1000
# Specify output directory
python qr_transmitter.py encode myfile.py -o ./output_folder
# Skip validation (faster, no decoder libraries needed)
python qr_transmitter.py encode myfile.py --no-validate# Decode by listing all QR code files (most reliable on Windows)
python qr_transmitter.py decode folder\file_qr_001_of_008.png folder\file_qr_002_of_008.png folder\file_qr_003_of_008.png folder\file_qr_004_of_008.png folder\file_qr_005_of_008.png folder\file_qr_006_of_008.png folder\file_qr_007_of_008.png folder\file_qr_008_of_008.png -o recovered.py
# For many files, you can use a batch file or script to list them- File Splitting: Automatically splits files into optimal chunks for QR encoding
- Metadata Management: Each QR includes sequence numbers, checksums, and file info
- Integrity Verification: SHA-256 hashes ensure perfect reconstruction
- Binary Support: Handles both text and binary files
- Progress Tracking: Visual progress bars during encoding/decoding
- Error Recovery: Can handle missing or corrupted QR codes with warnings
- Default Chunk Size: 1,800 characters (very reliable)
- Maximum Chunk Size: 2,953 characters (QR Version 40 limit)
- Error Correction: Low level by default (maximizes capacity)
- Output Format: PNG images with descriptive filenames
- Companion Files: Each QR gets a
.txtfile with metadata
- Generate QR codes on your computer
- Take clear photos of each QR code with your phone
- Transfer photos to target computer (email, USB, cloud)
- List all photo files in the decode command
- Use a QR scanner app that can export data
- Scan each QR code in order
- Save the JSON data from each scan
- Transfer the saved data files to decode
- Ensure good lighting and steady hand
- Keep phone perpendicular to QR code
- Scan in numbered order when possible
- Verify each scan shows JSON data starting with
{"metadata":
- Air-Gapped Systems: Transfer code to computers without network access
- Conference Presentations: Share code via projected QR codes
- Physical Backups: Print QR codes as paper backup of critical files
- Cross-Platform Transfer: Move files between incompatible systems
- Educational Settings: Distribute code without network setup
python qr_transmitter.py encode [options] <input_file>
Options:
-o, --output DIR Output directory for QR codes
-c, --chunk-size SIZE Characters per QR code (default: 1800, max: 2953)
--no-validate Skip QR code validation
--quiet Suppress progress output
python qr_transmitter.py decode [options] <qr_images...>
Options:
-o, --output FILE Output file path for reconstructed file
--quiet Suppress progress output
Arguments:
qr_images List of QR code image files to decode
Pro Tip: For the most reliable decoding on Windows, always list QR files explicitly rather than using directory or wildcard patterns. Consider creating a batch file to automate the file listing for large sets of QR codes.
| Chunk Size | QR Density | Scan Difficulty | Best For |
|---|---|---|---|
| 1000 | Low | Very Easy | Phone scanning, poor cameras |
| 1800 (default) | Medium | Easy | General use, reliable scanning |
| 2500 | High | Moderate | Good scanners, fewer QRs needed |
| 2953 (max) | Very High | Hard | Professional scanners only |
Problem: Directory decoding doesn't work Solution: List files explicitly in the decode command
Problem: Wildcards don't expand properly Solution: Use explicit file listing or create a batch file
Problem: "QR decoder not available"
Solution: Install pyzbar and opencv-python:
pip install pyzbar opencv-python
pip install pyzbar[scripts] # If needed on WindowsProblem: pyzbar installation fails
Solution: Use --no-validate flag when encoding (skips validation)
Problem: "Invalid version" error
Solution: Reduce chunk size with -c option (try 1000 or 1500)
Problem: Too many QR codes generated Solution: Increase chunk size (try 2500, max 2953)
When encoding myfile.py, the program creates:
myfile_qrcodes/
├── myfile_qr_001_of_005.png # QR code image
├── myfile_qr_001_of_005.txt # Metadata file
├── myfile_qr_002_of_005.png
├── myfile_qr_002_of_005.txt
└── ...
Each QR contains JSON with:
- File metadata (name, chunk index, total chunks)
- Chunk data (portion of file content)
- Integrity hashes (chunk and file checksums)
# Create a test file
echo "Hello World" > test.txt
# Encode it
python qr_transmitter.py encode test.txt
# Decode it
python qr_transmitter.py decode test_qrcodes\test_qr_001_of_001.png -o recovered.txt# Encode a Python script with medium-sized chunks
python qr_transmitter.py encode script.py -c 2000
# Decode listing all generated QR codes
python qr_transmitter.py decode script_qrcodes\script_qr_001_of_010.png script_qrcodes\script_qr_002_of_010.png [...all files...] -o recovered_script.py# Encode a binary file (automatically handled)
python qr_transmitter.py encode image.jpg
# Decode back to binary
python qr_transmitter.py decode image_qrcodes\*.png -o recovered_image.jpg- Maximum file size limited by patience (more QRs = more scanning)
- QR scanning quality depends on camera and lighting
- Large files may generate many QR codes (adjust chunk size accordingly)
- Directory decoding may not work on all systems (use file listing instead)
Consider adding:
- Alternative QR decoder libraries
- Batch processing scripts
- GUI interface
- Mobile app for scanning
- Automatic file listing generation
Free to use and modify for any purpose.