/qrw

:high_brightness: Output QR codes for Go

Primary LanguageGoMIT LicenseMIT

QRCode Writer

Output QR codes for Go

Build Status Coverage Status GoDoc

Features

  • Output to text
    • two characters as a block
    • half character as a block
  • Output to terminal
    • bash
    • zsh
  • Output to file
    • text
    • png
    • jpeg

Example

As shown in the figure, you can get started quickly with the following example:

image

BlockWriter

Show a QR block by two characters.

Output to io.Writer:
BlockWrite(os.Stdout, L, "Hello world!")
Output to file:
BlockWriteFile("file_path", L, "Hello world!")

HalfBlockWriter

Show a QR block by half character.

Output to io.Writer:
HalfBlockWrite(os.Stdout, L, "Hello world!")
Output to file:
HalfBlockWriteFile("file_path", L, "Hello world!")

Usage

Common functions:

func BlockWrite(io.Writer, Level, string) error
func BlockWriteFile(string, Level, string) error
func HalfBlockWrite(io.Writer, Level, string) error
func HalfBlockWriteFile(string, Level, string) error
func Bash(Level, string) error
func PNG(string, Level, string) error
func JPEG(string, Level, string) error

See document.

Level(error correction level)

From least to most tolerant of errors:

  • L 20% redundant
  • M 38% redundant
  • Q 55% redundant
  • H 65% redundant

The definitions comes from rsc/qr.

Install

go get -u github.com/WindomZ/qrw

Related