qrlogo

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2020 License: MIT Imports: 5 Imported by: 2

README

go.dev reference

Intro

QRLogo is a small library and command line to generate QR images with small logo placed in the center.

Thanks to redundancy in the QE codes nature, code remains readable even if part of its covered by image, i.e. logo. It allows to create nice branded-like QR codes.

Demo

Install

To install command line tool:

go get github.com/divan/qrlogo/cmd/qrlogo

Or only lib (basically, the same, but without installing binary):

go get github.com/divan/qrlogo

Usage

Command line tool

For command line tool, it's enough to specify input image (i.e. logo) and text or URL to be encoded:

qrlogo -i logo.png http://githib.com/divan/qrlogo

Output will be written to qr.png file in PNG format.

You can also specify output filename and image size (512px by default). See -help output for details.

Note, that resizing logo image is up to you, it will be placed on top of resulting QR code without resizing or guessing proportions.

Library

For the library, usually it's enough to call only qrlogo.Encode() function, but if you need more precise controls, create new qrlogo.Encoder and set the values you need. See Documentation for more details.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultEncoder = Encoder{
	AlphaThreshold: 2000,
	GreyThreshold:  30,
	QRLevel:        qr.Highest,
}

DefaultEncoder is the encoder with default settings.

Functions

func Encode

func Encode(str string, logo image.Image, size int) (*bytes.Buffer, error)

Encode encodes QR image, adds logo overlay and renders result as PNG.

Types

type Encoder

type Encoder struct {
	AlphaThreshold int
	GreyThreshold  int
	QRLevel        qr.RecoveryLevel
}

Encoder defines settings for QR/Overlay encoder.

func (Encoder) Encode

func (e Encoder) Encode(str string, logo image.Image, size int) (*bytes.Buffer, error)

Encode encodes QR image, adds logo overlay and renders result as PNG.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL