go_qrcode

package module
v0.0.0-...-33ead13 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

README

go_qrcode

golang 编码,解码二维码 ,感谢 bieber的帮助
解码需要#include <zbar.h> c语言库的支持(例如:pip install zbar)

开始要 go get github.com/happyEgg/go_qrcode  

引入第三方库 go get github.com/boombuler/barcode

例子   package main  

import (
"fmt"
"image/png"
"os"

"github.com/happyEgg/go_qrcode"

)

func main() {

img := qrcode.Encode("test qrcode", 300, 300)

file, err := os.Create("./test.png")
if err != nil {  
	fmt.Println(err)  
	return  
}

defer file.Close()  

err = png.Encode(file, img)  
if err != nil {  
	fmt.Println(err)  
	return  
}

value := qrcode.Decode("./test.png")  
fmt.Println(value)

}

Documentation

Index

Constants

View Source
const (
	VERSION = 1.0
)

Variables

This section is empty.

Functions

func Decode

func Decode(imgPath string) string

func Encode

func Encode(value string, width, height int) image.Image

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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