Skip to main content

Binary QR Converter

A simple CLI tool to convert binary files to QR codes and back.

Features

  • Convert any binary file to a series of QR codes
  • Decode QR codes back to the original binary file
  • Compression to reduce the number of QR codes needed
  • Error correction for reliable decoding
  • File integrity verification using SHA-256 hashing
  • Cross-platform compatibility (Windows, macOS, Linux)

Prerequisites

  • Python 3.6 or higher
  • For decoding QR codes, you need to install the ZBar library:
    • On Ubuntu/Debian: sudo apt-get install libzbar0
    • On macOS: brew install zbar
    • On Windows: Download from SourceForge

Setup

  1. Clone or download this repository
  2. Install dependencies:
    pip install -r requirements.txt
    
  3. Make the script executable (Linux/macOS):
    chmod +x binary_qr.py
    

Usage

Encoding a binary file to QR codes

python binary_qr.py encode path/to/file.bin -o output_directory

Options:

  • -o, --output-dir: Directory to save QR code images (default: ./qrcodes)
  • -c, --chunk-size: Size of binary chunks in bytes (default: 1024)
  • -v, --qr-version: QR code version (1-40, higher means more capacity) (default: 40)
  • -z, --compression-level: Zlib compression level (0-9) (default: 9)

Decoding QR codes back to a binary file

python binary_qr.py decode path/to/qrcodes/*.png -o output_directory

or

python binary_qr.py decode path/to/qrcodes/ -o output_directory

Options:

  • -o, --output-dir: Directory to save the reconstructed file (default: ./output)

Show version information

python binary_qr.py version

Examples

Encode a PDF file to QR codes

python binary_qr.py encode document.pdf -o qrcodes/

Decode QR codes back to the original PDF

python binary_qr.py decode qrcodes/ -o recovered/

Run the example script

python example.py

How it works

  1. The binary file is compressed using zlib to reduce size
  2. The compressed data is split into chunks
  3. Each chunk is encoded with metadata (chunk index, total chunks, filename, file hash)
  4. Each chunk with metadata is converted to a QR code image
  5. When decoding, the QR codes are read, and the chunks are reassembled
  6. The reassembled data is decompressed to recover the original file
  7. The file hash is verified to ensure data integrity

Tips for optimal use

  • Adjust chunk size: For larger files, increasing the chunk size (-c option) can reduce the number of QR codes but may make them more complex and harder to scan.
  • QR code version: Higher versions (up to 40) can store more data but require higher resolution scanning.
  • Compression level: The default level (9) provides maximum compression but takes longer. Lower values (1-8) are faster but produce more QR codes.
  • Printing QR codes: When printing, ensure high quality and sufficient size for reliable scanning.
  • Scanning: Use a good camera in well-lit conditions for best results when scanning QR codes.

Troubleshooting

  • Missing ZBar library: If you get an error about missing ZBar, install it using the instructions in the Prerequisites section.
  • QR code decoding fails: Make sure all QR codes are clearly visible and not damaged. Try increasing the error correction level.
  • File too large: Try increasing the chunk size or QR code version to reduce the number of QR codes.
  • Invalid QR version: Make sure to use a QR version between 1 and 40.

License

MIT License

Metadata

Release files for binary-qr-converter 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for binary-qr-converter 0.1.0
File Size Uploaded Provenance Actions
binary_qr_converter-0.1.0.tar.gz 9.1 kB Without provenance Details for binary_qr_converter-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for binary-qr-converter 0.1.0
File Interpreter ABI Platform Actions
binary_qr_converter-0.1.0-py3-none-any.whl Python 3 none any Details for binary_qr_converter-0.1.0-py3-none-any.whl

Total release size: 18.1 kB

Release files / binary_qr_converter-0.1.0.tar.gz

Download URL binary_qr_converter-0.1.0.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
098ecd80d7b1b4f49e946d01cf8a35df2d5e1fc9bff3486376ded0ee2a67babf
BLAKE2b-256 checksum
How to use checksums
bbc672a46a9a339f4578a4d5c3090135e172698f5fde05138e4df7a73f2bb6c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Release files / binary_qr_converter-0.1.0-py3-none-any.whl

Download URL binary_qr_converter-0.1.0-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99fc04baf5054eeaa420d8eee3b277fb8a5dcbfc464ac5f3416b52ce13c43231
BLAKE2b-256 checksum
How to use checksums
9895edc86297bfc99a87016e7358fcb5bca5a3b13e2d6b433b28623d3413d3cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Security for binary-qr-converter 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page