Package qart implements a QR Code encoder, basing on go-qrcode, with other funny features.
There are two ways to get executable file.
-
Download the executable file in project's releases or
qart/bin
folder. -
Build yourself.
go get -u github.com/xrlin/qart/...
A command-line tool
qart
will be built into$GOPATH/bin/
.
# create code with png
qart -m test.png -o out.png http://example.com
# create code with specified area of png
qart -m test.png -startX 100 -startY 100 -width 100 -oout.png http://example.com
# overlay code on source image
qart -m test.png -startX 100 -startY 100 -width 100 -embed true -o out.gif http://example.com
# create code with gif
qart -m illya.gif -o out.png http://example.com
More options can found by
qart -h
import "github.com/xrlin/qart"
q, err := qrcode.NewHalftoneCode(content, qrcode.Highest)
q.AddOption(qart.Option{Embed: false, MaskImagePath: "test.png"})
pointWidth := 3
// Get the image.Image represents the qr code
ret := q.CodeImage(pointWidth)
// Get the bytes of image
imgBytes, err := q.ImageData(pointWidth)
Read the godoc for more usages.