Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qpliu/qrencode-go
QR encoder in Go
https://github.com/qpliu/qrencode-go
go qr-code qr-generator
Last synced: about 2 months ago
JSON representation
QR encoder in Go
- Host: GitHub
- URL: https://github.com/qpliu/qrencode-go
- Owner: qpliu
- License: lgpl-3.0
- Created: 2012-07-23T07:38:15.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2020-06-19T07:37:16.000Z (over 4 years ago)
- Last Synced: 2024-08-01T19:55:36.056Z (5 months ago)
- Topics: go, qr-code, qr-generator
- Language: Go
- Size: 17.6 KB
- Stars: 117
- Watchers: 8
- Forks: 27
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
QR encoder in Go based on the ZXing encoder (http://code.google.com/p/zxing/).
[![GoDoc](https://godoc.org/github.com/qpliu/qrencode-go/qrencode?status.svg)](https://godoc.org/github.com/qpliu/qrencode-go/qrencode)
[![Build Status](https://travis-ci.org/qpliu/qrencode-go.svg?branch=master)](https://travis-ci.org/qpliu/qrencode-go)I was surprised that I couldn't find a QR encoder in Go, especially
since the example at http://golang.org/doc/effective_go.html#web_server
is a QR code generator, though the QR encoding is done by an external
Google service in the example.# Example
```go
package mainimport (
"bytes"
"image/png"
"os""github.com/qpliu/qrencode-go/qrencode"
)func main() {
var buf bytes.Buffer
for i, arg := range os.Args {
if i > 1 {
if err := buf.WriteByte(' '); err != nil {
panic(err)
}
}
if i > 0 {
if _, err := buf.WriteString(arg); err != nil {
panic(err)
}
}
}
grid, err := qrencode.Encode(buf.String(), qrencode.ECLevelQ)
if err != nil {
panic(err)
}
png.Encode(os.Stdout, grid.Image(8))
}
```