Minimal QRWidth to get maximum size of logo
tchukuchuk opened this issue · comments
Hi,
I am wondering if there is a way to compute the minimal QRWidth to have the maximum size of logo.
Any idea ?
Regards.
I'm afraid no, logo size is limited to one-fifth of QR Code, but actually, QR Code size of not determined, so there is not a formula to calculate.
This feature looks like weak to use, I'm sorry about this
How about setting the logo image with size max percent limitation, choosing the mininum size between max-percent and actually logo image size while drawing logo image?
For example:
logoSize = {w: 30, h: 30}
qr = {w:120, h:120}
maxPercent = 20% = 24
logoSize = min(logoSize, maxPercent)
logo image would be scale automatically if the actual image is oversize. Would this be helpful in your case?
Thanks for your reply. If it's possible I prefer to set the cell width instead of resizing logo image.
I have implemented this to get the appropriate cell width (QRWidth option) :
qrImageWidth := 5*logoWidth + borderWidth*2
qrCodeWidth := qrImageWidth / qrc.Dimension()
if (qrImageWidth % qrc.Dimension()) != 0 {
qrCodeWidth = qrCodeWidth + 1
}
opt := standard.WithQRWidth(qrCodeWidth)
My logo image is large and it is a square.
I have a question: If your logo image is large enough, the output QR Code will be so bigger, that's really what do you want? 😂
Yes ! :)
fine 😁