Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase file size limitation in QR Code Generation #8

Open
Xolo978 opened this issue Jan 2, 2025 · 8 comments
Open

Increase file size limitation in QR Code Generation #8

Xolo978 opened this issue Jan 2, 2025 · 8 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers Intermediate SWOC

Comments

@Xolo978
Copy link

Xolo978 commented Jan 2, 2025

Problem: File Size Limitation in QR Code Generation

Description

The current implementation of the QR code generator tool supports encoding small files (< 2KB) into a single QR code. However, this limitation arises due to:

  1. The inherent data capacity of QR codes (~3KB for raw binary data).
  2. The use of Base64 encoding, which introduces ~33% overhead, further reducing the practical size limit.

This restricts users from encoding slightly larger files (e.g., 2.5KB uncompressed), even after compression.

Proposed Approaches

  1. Maximize QR Code Capacity:

    • Switch from Base64 encoding to QR code's native binary mode.
    • Use compression (e.g., pako.deflate) to further reduce file size before encoding.
    • This approach increases the effective file size limit to ~2.9KB.
  2. Split Large Files into Multiple QR Codes:

    • Files exceeding the ~2.9KB limit could be split into chunks.
    • Each chunk is encoded into a separate QR code.
    • Provide instructions or tools to reassemble the file from multiple QR codes.

Trade-offs

  • Maximizing QR Code Capacity:

    • Pros: Keeps the process simple for users, no need for additional scanning steps.
    • Cons: Cannot handle files larger than ~2.9KB, even with compression.
  • Splitting Large Files:

    • Pros: Enables encoding of much larger files.
    • Cons: Users need to scan and reassemble multiple QR codes, which may feel cumbersome.

Request for Feedback

Would you prefer to:

  1. Prioritize a simpler approach by maximizing single QR code capacity?
  2. Implement file splitting to allow for encoding larger files, even if it adds complexity?
Copy link

github-actions bot commented Jan 2, 2025

👋 Thanks for opening this issue! We appreciate your contribution. Please make sure you’ve provided all the necessary details and screenshots, and don't forget to follow our Guidelines and Code of Conduct. Happy coding! 🚀

@amanraox
Copy link
Owner

amanraox commented Jan 2, 2025

great idea @Xolo978. seems good but for 2nd part i am not sure. i'll do some research later. for now try this

@amanraox amanraox added enhancement New feature or request level2 labels Jan 2, 2025
@GhostisLive
Copy link

Assign it to me as well, I will help.

@amanraox
Copy link
Owner

amanraox commented Jan 3, 2025

ok @GhostisLive

@GhostisLive
Copy link

@amanraox can u check if you can generate the qrcode, I cannot generate it after the new UI design.

@amanraox
Copy link
Owner

amanraox commented Jan 6, 2025

yes its working fine.

@GhostisLive
Copy link

@amanraox ok, its working now

@Xolo978
Copy link
Author

Xolo978 commented Jan 7, 2025

Additional Proposal: Offline File Sharing via Local Network

Given the constraints of QR code capacity (even with splitting and compression), I propose an alternative approach for sharing files offline that could complement or replace the current QR code-only system.

Proposed Solution

The idea is to leverage the file sender's device (e.g., a computer) as a local server that other devices can connect to. Here's how it would work:

  1. Local Network Setup:

    • The sender's computer would create a local Wi-Fi hotspot (or leverage an existing one) with a custom SSID and password.
    • This allows nearby devices to connect without requiring internet access.
  2. Local Server for File Hosting:

    • A lightweight HTTP server (e.g., Python's http.server) is set up on the sender's device to host the file to be shared.
    • The file is uploaded to the server, generating a unique local URL (e.g., http://192.168.1.1/file).
  3. QR Code for File Access:

    • A QR code is generated with the local URL.
    • Other devices connected to the hotspot can scan the QR code to directly download the file from the local server.

Advantages

  1. Bypasses QR Code Size Limit:

    • Instead of encoding the file into the QR code, the QR code only points to a URL, allowing for sharing files of much larger sizes.
  2. Simplified User Experience:

    • Users don't need to handle multiple QR codes or reassemble chunks. They simply scan the code and download the file.
  3. Extends Use Cases:

    • Enables sharing files up to several MBs in size (limited only by the local server's capabilities).

Challenges and Considerations

  1. Wi-Fi Hotspot Creation:

    • Not all devices may support creating Wi-Fi hotspots programmatically, and permissions may vary by platform (e.g., Windows, macOS, Linux).
    • This would need platform-specific implementations.
  2. Firewall and Security Issues:

    • Some systems may block the local server or hotspot creation due to firewall rules or administrative restrictions.
  3. Device Compatibility:

    • All recipient devices must support connecting to a local network and scanning QR codes.
  4. Implementation Complexity:

    • This approach introduces additional dependencies for server setup and hotspot creation.

Would this approach align with the project goals as a complement or alternative to the current QR-based system?

  • If yes, are there any concerns regarding its implementation or user adoption?
  • If no, should we focus solely on improving the QR code-based method despite the size limitations?

@amanraox amanraox removed the swoc2025 label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers Intermediate SWOC
Projects
None yet
Development

No branches or pull requests

3 participants