From a4e3d9eecf6b8fc324b0e120dc9fa27d3efe32f1 Mon Sep 17 00:00:00 2001 From: boombuler Date: Thu, 12 Dec 2013 21:02:54 +0100 Subject: [PATCH] added example --- qr/encoder_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/qr/encoder_test.go b/qr/encoder_test.go index d56f139..9304faf 100644 --- a/qr/encoder_test.go +++ b/qr/encoder_test.go @@ -1,6 +1,10 @@ package qr import ( + "fmt" + "github.com/boombuler/barcode" + "image/png" + "os" "testing" ) @@ -52,3 +56,20 @@ func Test_Encode(t *testing.T) { } } } + +func ExampleEncode() { + f, _ := os.Create("qrcode.png") + defer f.Close() + + qrcode, err := Encode("hello world", L, Auto) + if err != nil { + fmt.Println(err) + } else { + qrcode, err = barcode.Scale(qrcode, 100, 100) + if err != nil { + fmt.Println(err) + } else { + png.Encode(f, qrcode) + } + } +}