go-tinyqr

An experimental minimal QR Code generator  http://go-qrcode.appspot.com
git clone https://git.ce9e.org/go-tinyqr.git

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     2 
    3    -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     5 
    5    -1 Package 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)
   -1     6 In order to reduce the size, I mostly removed options:
    6     7 
    7    -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    11 
    9    -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    15 
   11    -1 ## Install
   12    -1 
   13    -1     go get -u github.com/skip2/go-qrcode/...
   14    -1 
   15    -1 A command-line tool `qrcode` will be built into `$GOPATH/bin/`.
   16    -1 
   17    -1 ## Usage
   18    -1 
   19    -1     import qrcode "github.com/skip2/go-qrcode"
   20    -1 
   21    -1 - **Create a 256x256 PNG image:**
   22    -1 
   23    -1         var png []byte
   24    -1         png, err := qrcode.Encode("https://example.org", qrcode.Medium, 256)
   25    -1 
   26    -1 - **Create a 256x256 PNG image and write to a file:**
   27    -1 
   28    -1         err := qrcode.WriteFile("https://example.org", qrcode.Medium, 256, "qr.png")
   29    -1 
   30    -1 - **Create a 256x256 PNG image with custom colors and write to file:**
   31    -1 
   32    -1         err := qrcode.WriteColorFile("https://example.org", qrcode.Medium, 256, color.Black, color.White, "qr.png")
   33    -1 
   34    -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    -1 
   36    -1 ## Documentation
   37    -1 
   38    -1 [![godoc](https://godoc.org/github.com/skip2/go-qrcode?status.png)](https://godoc.org/github.com/skip2/go-qrcode)
   39    -1 
   40    -1 ## Demoapp
   41    -1 
   42    -1 [http://go-qrcode.appspot.com](http://go-qrcode.appspot.com)
   43    -1 
   44    -1 ## CLI
   45    -1 
   46    -1 A command-line tool `qrcode` will be built into `$GOPATH/bin/`.
   47    -1 
   48    -1 ```
   49    -1 qrcode -- QR Code encoder in Go
   50    -1 https://github.com/skip2/go-qrcode
   51    -1 
   52    -1 Flags:
   53    -1   -d	disable QR Code border
   54    -1   -i	invert black and white
   55    -1   -o string
   56    -1     	out PNG file prefix, empty for stdout
   57    -1   -s int
   58    -1     	image size (pixel) (default 256)
   59    -1   -t	print as text-art on stdout
   60    -1 
   61    -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 display
   64    -1      on any X server.
   65    -1 
   66    -1        qrcode hello word | display
   67    -1 
   68    -1   2. Save to file if "display" not available:
   69    -1 
   70    -1        qrcode "homepage: https://github.com/skip2/go-qrcode" > out.png
   71    -1 
   72    -1 ```
   73    -1 ## Maximum capacity
   74    -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    -1 
   76    -1 ## Borderless QR Codes
   77    -1 
   78    -1 To aid QR Code reading software, QR codes have a built in whitespace border.
   79    -1 
   80    -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    21 
   84    -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/)