Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 1.28 KB

README.md

File metadata and controls

54 lines (37 loc) · 1.28 KB

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