Skip to content

shezadkhan137/go-qrcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A light golang wrapper around zbar, used for qr code processing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published