/qart

A halfton qrcode generator written in golang. 用Go实现的一个二维码生成库

Primary LanguageGoMIT LicenseMIT

Qart

Build Status godoc

Package qart implements a QR Code encoder, basing on go-qrcode, with other funny features.

Install

There are two ways to get executable file.

  1. Download the executable file in project's releases or qart/bin folder.

  2. Build yourself.

    go get -u github.com/xrlin/qart/...

    A command-line tool qart will be built into $GOPATH/bin/.

CLI

# 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

Usage

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.

DemoApp

https://xrlin.github.io/qart-web

Examples

example example example

example

Links