fukuchi / libqrencode

A fast and compact QR Code encoding library
https://fukuchi.org/works/qrencode/
GNU Lesser General Public License v2.1
2.57k stars 599 forks source link

Generate a QR code image with logo #207

Open okman334 opened 1 year ago

okman334 commented 1 year ago

I want to try to use libpng and libqrencode to generate a QR code image with a small logo in the middle, but I haven't found a good implementation method. I don't know if anyone can provide some implementation methods. Thanks.

Yenya commented 10 months ago

Just a me too: I would like to have this feature implemented in qrencode/libqrencode.

In the meantime, there is an alternative encoder which apparently supports it: https://github.com/lincolnloop/python-qrcode/

PhilterPaper commented 7 months ago

If you are drawing the QRcode as an image of some sort (the usual practice), I suppose you could simply draw your logo as a fully opaque image right "over" (after) the QRcode. Have you tried that yet?

Keep in mind that while logos, etc. over QRcodes are fairly common, you are in fact damaging the code, and using up some of the redundancy that was provided with the code. That is, if someone cuts off or damages some other part of the code, it is possible that you will not have enough "good" code left for a quality read of the code. You will need to set your QRcode generation to be of higher "quality" (higher redundancy) that you might otherwise employ, to account for the damage that you are going to deliberately inflict on the code right away, so that "normal" wear and tear on the QRcode can still be compensated for and the code successfully read.

I have no idea if there are any QRcode layouts defined that leave a space in the middle for a picture or logo, and if there is, whether libqrencode supports it. You might first take a deep dive into the documentation to see if both are true.

Yenya commented 7 months ago

There is in fact a type of QR code, which leaves the middle area for other purposes, without damaging the data with it - FrameQR:

https://www.denso-wave.com/en/system/qr/fundamental/qrcode/frameqr/index.html

However, it seems that FrameQR is still proprietary by Denso Wave, and for example BinaryEye Android App cannot read the examples in that page.

Standard QR codes with logos just use higher level of redundancy to account for data damaged by overlapping it with logo.

PhilterPaper commented 7 months ago

Interesting. I wouldn't be surprised if FrameQR is patented, or otherwise protected, and can't be written by other parties (yet). I wonder if that Python code mentioned above is heading towards an infringement suit, or if they have a license? Find out before you use it!

Yenya commented 7 months ago

@PhilterPaper - I think the above-linked Python code just overlaps the QR code with the logo. I don't think they implement FrameQR. And I agree that FrameQR itself can be patent encubered.