boombuler/barcode生成二维码
最后更新于:2022-04-02 04:57:40
**boombuler/barcode生成二维码**
github地址:https://github.com/boombuler/barcode
获取:
~~~
go get github.com/boombuler/barcode
~~~
生成二维码图片:
~~~
package main
import (
"image/png"
"os"
"github.com/boombuler/barcode"
"github.com/boombuler/barcode/qr"
)
func main() {
qrCode, _ := qr.Encode("http://blog.csdn.net/wangshubo1989", qr.M, qr.Auto)
qrCode, _ = barcode.Scale(qrCode, 256, 256)
file, _ := os.Create("qr2.png")
defer file.Close()
png.Encode(file, qrCode)
}
~~~
';