goq
github.com/kiktomo/goqr
go get github.com/kiktomo/goqr
goq

github.com/kiktomo/goqr

A QRcode generator written in Go.

by Tomohiro Onuma

v0.0.0-20140410071556-a2b125f3645d (see all)License:MIT
go get github.com/kiktomo/goqr
Readme

goqr

goqr - a QRcode generator written in Go.

Install

goqr is available at github.com. Get it by running.

$ go get github.com/kiktomo/goqr

Sample code

package main

import (
    "github.com/kiktomo/goqr"
    "image/png"
    "os"
)

func main() {

    // "0123456789" -> Numeric mode
    // "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:" -> Alphanumeric mode
    // "HELLO WORLD" -> Alphanumeric mode (upper-case only)
    // "Hello world" -> 8BitByte mode
    txt := "HELLO WORLD"

    // QRcode version:7
    // version := 0 (Auto)
    version := 7

    // QRcode error correction level: "M"
    // eclevel := 0 (Auto)
    eclevel := goqr.ECLevelM

    // Encode() returns image.Image
    qr, err := goqr.Encode(txt, version, eclevel)
    if err != nil {
        return
    }

    // png file output
    f, _ := os.Create("./qrcode.png")
    defer f.Close()
    png.Encode(f, qr)
}

GitHub Stars

11

LAST COMMIT

8yrs ago

MAINTAINERS

0

CONTRIBUTORS

1

OPEN ISSUES

1

OPEN PRs

0
VersionTagPublished
v0.0.0-20140410071556-a2b125f3645d
2yrs ago
No alternatives found
No tutorials found
Add a tutorial