skip2 / go-qrcode

:sparkles: QR Code encoder (Go)
http://go-qrcode.appspot.com
MIT License
2.58k stars 335 forks source link

Facing issue while generating qrcode png content #65

Open nitin455 opened 5 months ago

nitin455 commented 5 months ago

I am trying to use this library for generating QR code. I am calling qrcode.PNG() function to get bytes of qrcode in PNG form. But the problem is, i am not getting consistent results from this lib.

Below is my code:

qcode, err := qrcode.New("CONTENT-TO-BE-USED", qrcode.Medium)
if err != nil {
fmt.Println(err)
}
b, err := qcode.PNG(100) // tried different sizes like 256, 140, 130, and 100
if err != nil {
fmt.Println(err)
}
t.QRCode = string(b)

here t.QRCode is used in html template with image tag to load qr code on web page.

Anything is wrongly done here?

nitin455 commented 5 months ago
image

here is sample qr code generated. This doesnt created fully. The bottom part is missing.

This is not consistent. Few times, it generates proper qr code but few times it fails.