erwanvivien / fast_qr

Ultra fast QRCode generation
https://fast-qr.com/
MIT License
197 stars 29 forks source link

Feature Request: Remove modules under image in SVG output #64

Open TheAwiteb opened 1 month ago

TheAwiteb commented 1 month ago

Currently, the SVG output includes modules beneath the image. By removing these, the QR code will have a more polished and professional look.

erwanvivien commented 1 month ago

The reason I kept the modules behind the image was that since the image can be remote (not base64) it could take time to load, having modules behind makes the QRCode valid and not weird in the transition.

You tried with transparent images, is that the problem?

TheAwiteb commented 1 month ago

having modules behind makes the QRCode valid and not weird in the transition.

Maybe we can make it an option? Because if I'm using a base64 image, I'd prefer to remove the background modules. However, if the image is a remote image, I would be afraid that the image might have been deleted or changed, and the QR code would look unacceptable. So it depends on how you bring the image, so I think it's good that it's an option and not there by default.

You tried with transparent images, is that the problem?

Yes, as you can see below the Rust logo is hard to see

Also with Forgejo logo, I think it's will be better if we remove the background modules

With background modules Without background modules With White Background

White background

A white background works well if your QR code background is white. If it's not (which is uncommon), you can change it to match your background color. However, if you're not using square modules, the white background is not ideal because parts of the modules will be visible behind the background, as you can see below

TheAwiteb commented 1 month ago

When I zoom in on the white square background, I can see some of the modules that lie behind the background, as you can see below.

erwanvivien commented 1 month ago

Yep I understand the issue, It's an alignment problem of the underlying renderers (Chrome for example)

That said it's ugly and can be fixed. I'll have to think of a better way to do Shape::Command and include color in it.