Rhymen / go-whatsapp

WhatsApp Web API
MIT License
2.09k stars 493 forks source link

Save Qr Code Image #264

Open 0xhex opened 4 years ago

0xhex commented 4 years ago

Hello,i couldn't find the qr code string in source. I want to save qr code image as a file,i dont want to show it in terminal Any help?

abnt713 commented 4 years ago

The Login method for the type *whatsapp.Conn writes the QR Code data into a string channel. You can use this channel to generate a QR Code Image and save it to a file. The login example shows how to handle the QR Code data using a goroutine and the terminal. The same concept can be applied to an image based approach.

kaxap commented 4 years ago

Use github.com/skip2/go-qrcode

To visualize the QR code to PNG.

e1milio commented 4 years ago

Yo hice lo siguiente:

terminal := qrcodeTerminal.New()
qrCode := <-qr
terminal.Get(qrCode).Print()
qrToImg(qrCode)

func qrToImg(qrCode string) {

    err := qrcode.WriteFile(qrCode, qrcode.Medium, 256, "qr.png")
    if err != nil {
        fmt.Fprintf(os.Stderr, "No se pudo crear el archivo de imagen QR")
    } 
}
manishswami commented 3 years ago

how to show QR.png in go window form using github.com/lxn/walk... any solution...