go-qrcode

command module
v0.0.0-...-289feca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2016 License: GPL-2.0 Imports: 3 Imported by: 0

README

go-qrcode

A (very) light golang convenience wrapper around zbar, used for qr code processing.

Requirements

To compile this package requires the zbar header files which can be installed on debian/ubuntu with

sudo apt-get install libzbar-dev

Go get the library:

go get github.com/shezadkhan137/go-qrcode/qrcode

Usage (Currently under development)

It currently only supports extracting data from a PNG Image. Example Usage:

import (
    "fmt"
    "github.com/shezadkhan137/go-qrcode/qrcode"
)

func main() {
    results, err := qrcode.GetDataFromPNG("path/to/image.png")
    if err != nil {
        panic(err)
    }

    for _, result := range results{
        fmt.Printf("Symbol Type: %s, Data %s", result.SymbolType, result.Data )
    }

}

Building

Building a staticlly linked binary with cgo dependencies can be a little fragile, by default cgo libraries are dynamically linked so require the libzbar-dev to be present on machine running your binary. However the following command may work if you want to statically link the zbar libs into your go binary.

go build -ldflags "-linkmode external -extldflags -static"

TODO

  • Add support for extrating qr data from video via V4L2
  • Add support for other image types

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL