Created
April 15, 2016 00:57
-
-
Save csrgxtu/b415c269ee3bcc1e7e8ddab30d173f01 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/kiktomo/goqr" | |
"image/png" | |
"os" | |
) | |
func main() { | |
// "0123456789" -> Numeric mode | |
// "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:" -> Alphanumeric mode | |
// "HELLO WORLD" -> Alphanumeric mode (upper-case only) | |
// "Hello world" -> 8BitByte mode | |
txt := "HELLO WORLD" | |
// QRcode version:7 | |
// version := 0 (Auto) | |
version := 7 | |
// QRcode error correction level: "M" | |
// eclevel := 0 (Auto) | |
eclevel := goqr.ECLevelM | |
// Encode() returns image.Image | |
qr, err := goqr.Encode(txt, version, eclevel) | |
if err != nil { | |
return | |
} | |
// png file output | |
f, _ := os.Create("./qrcode.png") | |
defer f.Close() | |
png.Encode(f, qr) | |
} |
Author
csrgxtu
commented
Apr 15, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment