• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

bitset/H17-Jun-2020-

qrcode/H17-Jun-2020-

reedsolomon/H17-Jun-2020-

.gitignoreH A D17-Jun-202038

.travis.ymlH A D17-Jun-202055

LICENSEH A D17-Jun-20201 KiB

README.mdH A D17-Jun-20203.2 KiB

encoder.goH A D17-Jun-202012 KiB

encoder_test.goH A D17-Jun-20208.5 KiB

example_test.goH A D17-Jun-20201.1 KiB

go.modH A D17-Jun-202043

qrcode.goH A D17-Jun-202015.3 KiB

qrcode_decode_test.goH A D17-Jun-20204 KiB

qrcode_test.goH A D17-Jun-20202.9 KiB

regular_symbol.goH A D17-Jun-20206.2 KiB

regular_symbol_test.goH A D17-Jun-2020482

symbol.goH A D17-Jun-20206.8 KiB

symbol_test.goH A D17-Jun-20208.7 KiB

version.goH A D17-Jun-202030.2 KiB

version_test.goH A D17-Jun-20202.1 KiB

README.md

1# go-qrcode #
2
3<img src='https://skip.org/img/nyancat-youtube-qr.png' align='right'>
4
5Package qrcode implements a QR Code encoder. [![Build Status](https://travis-ci.org/skip2/go-qrcode.svg?branch=master)](https://travis-ci.org/skip2/go-qrcode)
6
7A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded, with URLs being a popular choice :)
8
9Each QR Code contains error recovery information to aid reading damaged or obscured codes. There are four levels of error recovery: Low, medium, high and highest. QR Codes with a higher recovery level are more robust to damage, at the cost of being physically larger.
10
11## Install
12
13    go get -u github.com/skip2/go-qrcode/...
14
15A command-line tool `qrcode` will be built into `$GOPATH/bin/`.
16
17## Usage
18
19    import qrcode "github.com/skip2/go-qrcode"
20
21- **Create a 256x256 PNG image:**
22
23        var png []byte
24        png, err := qrcode.Encode("https://example.org", qrcode.Medium, 256)
25
26- **Create a 256x256 PNG image and write to a file:**
27
28        err := qrcode.WriteFile("https://example.org", qrcode.Medium, 256, "qr.png")
29
30- **Create a 256x256 PNG image with custom colors and write to file:**
31
32        err := qrcode.WriteColorFile("https://example.org", qrcode.Medium, 256, color.Black, color.White, "qr.png")
33
34All examples use the qrcode.Medium error Recovery Level and create a fixed 256x256px size QR Code. The last function creates a white on black instead of black on white QR Code.
35
36## Documentation
37
38[![godoc](https://godoc.org/github.com/skip2/go-qrcode?status.png)](https://godoc.org/github.com/skip2/go-qrcode)
39
40## Demoapp
41
42[http://go-qrcode.appspot.com](http://go-qrcode.appspot.com)
43
44## CLI
45
46A command-line tool `qrcode` will be built into `$GOPATH/bin/`.
47
48```
49qrcode -- QR Code encoder in Go
50https://github.com/skip2/go-qrcode
51
52Flags:
53  -d	disable QR Code border
54  -i	invert black and white
55  -o string
56    	out PNG file prefix, empty for stdout
57  -s int
58    	image size (pixel) (default 256)
59  -t	print as text-art on stdout
60
61Usage:
62  1. Arguments except for flags are joined by " " and used to generate QR code.
63     Default output is STDOUT, pipe to imagemagick command "display" to display
64     on any X server.
65
66       qrcode hello word | display
67
68  2. Save to file if "display" not available:
69
70       qrcode "homepage: https://github.com/skip2/go-qrcode" > out.png
71
72```
73## Maximum capacity
74The maximum capacity of a QR Code varies according to the content encoded and the error recovery level. The maximum capacity is 2,953 bytes, 4,296 alphanumeric characters, 7,089 numeric digits, or a combination of these.
75
76## Borderless QR Codes
77
78To aid QR Code reading software, QR codes have a built in whitespace border.
79
80If you know what you're doing, and don't want a border, see https://gist.github.com/skip2/7e3d8a82f5317df9be437f8ec8ec0b7d for how to do it. It's still recommended you include a border manually.
81
82## Links
83
84- [http://en.wikipedia.org/wiki/QR_code](http://en.wikipedia.org/wiki/QR_code)
85- [ISO/IEC 18004:2006](http://www.iso.org/iso/catalogue_detail.htm?csnumber=43655) - Main QR Code specification (approx CHF 198,00)<br>
86- [https://github.com/qpliu/qrencode-go/](https://github.com/qpliu/qrencode-go/) - alternative Go QR encoding library based on [ZXing](https://github.com/zxing/zxing)
87