Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/zhang-jianqiang/go-qrcode

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/zhang-jianqiang/go-qrcode

  • v0.3.0
  • Source
  • Go
  • Socket score

Version published
Created
Source

go-qrcode

Package qrcode implements skip2/go-qrcode

A QR Code is a matrix (two-dimensional) barcode. Arbitrary content may be encoded, with URLs being a popular choice :)

Each QR Code contains error recovery information to aid reading damaged or obscured codes. There are four levels of error recovery: Low, medium, high and highest. QR Codes with a higher recovery level are more robust to damage, at the cost of being physically larger.

Install

go get github.com/zhang-jianqiang/go-qrcode

Usage

package main

import (
	"fmt"
	"github.com/zhang-jianqiang/go-qrcode"
)

func main() {
	// Create png 100*100
	var img []byte
	img, _ = qrcode.Encode("https://cn.bing.com", qrcode.High, 100)
	fmt.Println(img)

	// Create png and write a file
	err := qrcode.WriteFile("https://cn.bing.com", qrcode.High, 100, "qrcode.png")
	fmt.Println(err)

	// Custom border blank
	img, _ = qrcode.Encode("https://cn.bing.com", qrcode.High, 100, qrcode.WithBorderSize(1))
	// Or
	err = qrcode.WriteFile("https://cn.bing.com", qrcode.High, 100, "qrcode.png", qrcode.WithBorderSize(1))
	fmt.Println(err)

	// Add logo
	logo, _ := os.Open("logo.png")

	img, _ = qrcode.Encode("https://cn.bing.com", qrcode.High, 100, qrcode.WithLogo(&qrcode.Logo{
		File: logo,
		Size: 40,
	}))
	// Or
	err = qrcode.WriteFile("https://cn.bing.com", qrcode.High, 100, "qrcode.png", qrcode.WithLogo(&qrcode.Logo{
		File: logo,
		Size: 40,
	}))
	fmt.Println(err)
}

FAQs

Package last updated on 03 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc