- commit
- 561ea7ec7517114b21688a84beef0b377206f005
- parent
- 536a881cd8b29099fa2c75e3155ca3e273e591a2
- Author
- Deleplace <deleplace2015@gmail.com>
- Date
- 2017-03-23 23:17
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)