go-tinyqr

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

commit
4c61b63be78398bebd08a352818e64c94226313e
parent
131cd4645209c5137215a1ea8c2706a4839b3987
Author
Tom Harwood <tfh@skip.org>
Date
2017-03-27 23:37
Merge pull request #7 from Deleplace/negative

Extra flag -i to invert black and white (negative photo).

Diffstat

M qrcode/main.go 7 ++++++-

1 files changed, 6 insertions, 1 deletions


diff --git a/qrcode/main.go b/qrcode/main.go

@@ -17,6 +17,7 @@ func main() {
   17    17 	outFile := flag.String("o", "", "out PNG file prefix, empty for stdout")
   18    18 	size := flag.Int("s", 256, "image size (pixel)")
   19    19 	textArt := flag.Bool("t", false, "print as text-art on stdout")
   -1    20 	negative := flag.Bool("i", false, "invert black and white")
   20    21 	flag.Usage = func() {
   21    22 		fmt.Fprintf(os.Stderr, `qrcode -- QR Code encoder in Go
   22    23 https://github.com/skip2/go-qrcode
@@ -56,11 +57,15 @@ Usage:
   56    57 	checkError(err)
   57    58 
   58    59 	if *textArt {
   59    -1 		art := qr2String(q, false)
   -1    60 		art := qr2String(q, *negative)
   60    61 		fmt.Println(art)
   61    62 		return
   62    63 	}
   63    64 
   -1    65 	if *negative {
   -1    66 		q.ForegroundColor, q.BackgroundColor = q.BackgroundColor, q.ForegroundColor
   -1    67 	}
   -1    68 
   64    69 	var png []byte
   65    70 	png, err = q.PNG(*size)
   66    71 	checkError(err)