Documentation ¶
Overview ¶
Example ¶
package main import ( "image/png" "os" "github.com/cristalhq/qrcode" ) func main() { url := "otpauth://totp/Example:alice@bob.com?secret=JBSWY3DPEHPK3PXP&issuer=Example" code, err := qrcode.Encode(url, qrcode.H) checkErr(err) f, err := os.Create("qr.png") checkErr(err) defer f.Close() err = png.Encode(f, code.Image()) checkErr(err) } func checkErr(err error) { if err != nil { panic(err) } }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code struct { Bitmap []byte // 1 is black, 0 is white Size int // number of pixels on a side Stride int // number of bytes per row Scale int // number of image pixels per QR pixel }
A Code is a square pixel grid. It implements image.Image and direct PNG encoding.
Click to show internal directories.
Click to hide internal directories.