- commit
- d4005362cd2084b101e4ab783b8cd3823ce9b766
- parent
- 610f346c61fe407e3474e9a9f30d882317d0069a
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2024-03-01 02:42
change README
Diffstat
| M | README.md | 94 | +++++++++++-------------------------------------------------- |
1 files changed, 16 insertions, 78 deletions
diff --git a/README.md b/README.md
@@ -1,86 +1,24 @@1 -1 # go-qrcode #-1 1 # go-tinyqr 2 23 -1 <img src='https://skip.org/img/nyancat-youtube-qr.png' align='right'>-1 3 This is an experimental QR code generator that aims to be as small as possible. -1 4 It is based on [go-qrcode](https://github.com/skip2/go-qrcode) by Tom Harwood. 4 55 -1 Package qrcode implements a QR Code encoder. [](https://travis-ci.org/skip2/go-qrcode)-1 6 In order to reduce the size, I mostly removed options: 6 77 -1 A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded, with URLs being a popular choice :)-1 8 - go-tinyqr always uses byte encoding. That's what you want most of the time anyway. -1 9 - go-tinyqr always uses the medium error correction level. -1 10 - go-tinyqr always uses mask pattern 0. 8 119 -1 Each 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.-1 12 Fixing all of these options leads to slightly worse results, but massivly -1 13 simplifies the code. For example, it allows to hardcode the complete format -1 14 info. 10 1511 -1 ## Install12 -113 -1 go get -u github.com/skip2/go-qrcode/...14 -115 -1 A command-line tool `qrcode` will be built into `$GOPATH/bin/`.16 -117 -1 ## Usage18 -119 -1 import qrcode "github.com/skip2/go-qrcode"20 -121 -1 - **Create a 256x256 PNG image:**22 -123 -1 var png []byte24 -1 png, err := qrcode.Encode("https://example.org", qrcode.Medium, 256)25 -126 -1 - **Create a 256x256 PNG image and write to a file:**27 -128 -1 err := qrcode.WriteFile("https://example.org", qrcode.Medium, 256, "qr.png")29 -130 -1 - **Create a 256x256 PNG image with custom colors and write to file:**31 -132 -1 err := qrcode.WriteColorFile("https://example.org", qrcode.Medium, 256, color.Black, color.White, "qr.png")33 -134 -1 All 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 -136 -1 ## Documentation37 -138 -1 [](https://godoc.org/github.com/skip2/go-qrcode)39 -140 -1 ## Demoapp41 -142 -1 [http://go-qrcode.appspot.com](http://go-qrcode.appspot.com)43 -144 -1 ## CLI45 -146 -1 A command-line tool `qrcode` will be built into `$GOPATH/bin/`.47 -148 -1 ```49 -1 qrcode -- QR Code encoder in Go50 -1 https://github.com/skip2/go-qrcode51 -152 -1 Flags:53 -1 -d disable QR Code border54 -1 -i invert black and white55 -1 -o string56 -1 out PNG file prefix, empty for stdout57 -1 -s int58 -1 image size (pixel) (default 256)59 -1 -t print as text-art on stdout60 -161 -1 Usage:62 -1 1. Arguments except for flags are joined by " " and used to generate QR code.63 -1 Default output is STDOUT, pipe to imagemagick command "display" to display64 -1 on any X server.65 -166 -1 qrcode hello word | display67 -168 -1 2. Save to file if "display" not available:69 -170 -1 qrcode "homepage: https://github.com/skip2/go-qrcode" > out.png71 -172 -1 ```73 -1 ## Maximum capacity74 -1 The 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 -176 -1 ## Borderless QR Codes77 -178 -1 To aid QR Code reading software, QR codes have a built in whitespace border.79 -180 -1 If 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.-1 16 Still, generating QR codes stays complex. I had hoped that I can reduce this -1 17 down to a small library that can just be copied to a new project. But it is -1 18 still ~1000 loc. 81 19 82 20 ## Links 83 2184 -1 - [http://en.wikipedia.org/wiki/QR_code](http://en.wikipedia.org/wiki/QR_code)85 -1 - [ISO/IEC 18004:2006](http://www.iso.org/iso/catalogue_detail.htm?csnumber=43655) - Main QR Code specification (approx CHF 198,00)<br>86 -1 - [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)-1 22 - [ISO/IEC 18004:2006](http://www.iso.org/iso/catalogue_detail.htm?csnumber=43655) -1 23 - [Nayuki: Creating a QR Code step by step](https://www.nayuki.io/page/creating-a-qr-code-step-by-step) -1 24 - [Thonky's QR Code tutorial](https://www.thonky.com/qr-code-tutorial/)