modulepackage
0.3.0
Repository: https://github.com/zhang-jianqiang/go-qrcode.git
Documentation: pkg.go.dev
# README
go-qrcode
Package qrcode implements skip2/go-qrcode
A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded, with URLs being a popular choice :)
Each QR Code contains error recovery information to aid reading damaged or obscured codes. There are four levels of error recovery: Low, medium, high and highest. QR Codes with a higher recovery level are more robust to damage, at the cost of being physically larger.
Install
go get github.com/zhang-jianqiang/go-qrcode
Usage
package main
import (
"fmt"
"github.com/zhang-jianqiang/go-qrcode"
)
func main() {
// Create png 100*100
var img []byte
img, _ = qrcode.Encode("https://cn.bing.com", qrcode.High, 100)
fmt.Println(img)
// Create png and write a file
err := qrcode.WriteFile("https://cn.bing.com", qrcode.High, 100, "qrcode.png")
fmt.Println(err)
// Custom border blank
img, _ = qrcode.Encode("https://cn.bing.com", qrcode.High, 100, qrcode.WithBorderSize(1))
// Or
err = qrcode.WriteFile("https://cn.bing.com", qrcode.High, 100, "qrcode.png", qrcode.WithBorderSize(1))
fmt.Println(err)
// Add logo
logo, _ := os.Open("logo.png")
img, _ = qrcode.Encode("https://cn.bing.com", qrcode.High, 100, qrcode.WithLogo(&qrcode.Logo{
File: logo,
Size: 40,
}))
// Or
err = qrcode.WriteFile("https://cn.bing.com", qrcode.High, 100, "qrcode.png", qrcode.WithLogo(&qrcode.Logo{
File: logo,
Size: 40,
}))
fmt.Println(err)
}
# Packages
Package bitset implements an append only bit array.
No description provided by the author
Package reedsolomon provides error correction encoding for QR Code 2005.
# Functions
Encode a QR Code and return a raw PNG image.
New constructs a QRCode.
NewWithForcedVersion constructs a QRCode of a specific version.
No description provided by the author
No description provided by the author
No description provided by the author
WriteColorFile encodes, then writes a QR Code to the given filename in PNG format.
WriteFile encodes, then writes a QR Code to the given filename in PNG format.