qrcodekit is a professional, extensible, and high-performance QR Code generation library for Go. Designed for backend developers, e-commerce systems, and print-ready applications.
- Simple & Fluent API: Generate QR codes in a single line.
- Advanced Styling:
- Custom Shapes: Rounded, Circle, Square.
- Linear & Radial Gradients.
- Custom Eye styling.
- Logo Overlay:
- Auto-scaling logo support.
- Smart error-correction upgrade ensures readability.
- Background plates for logos.
- Dual Engine:
- SVG: Vector-perfect, print-ready, CSS-compatible.
- PNG: High-quality raster with anti-aliasing (using bicubic interpolation).
- Payload Builders: Helpers for WiFi, vCard, Bitcoin, Email, SMS, etc.
- Zero-Config Defaults: Works out of the box with sensible defaults.
go get github.com/cagrico/qrcodekitpackage main
import (
"os"
"github.com/cagrico/qrcodekit"
"github.com/cagrico/qrcodekit/payload"
)
func main() {
qr, _ := qrcodekit.New(
qrcodekit.Content(payload.URL("https://example.com")),
)
// Save as PNG
pngData, _ := qr.PNG(512)
os.WriteFile("qr.png", pngData, 0644)
}Generate beautiful QR codes for marketing materials:
qr, _ := qrcodekit.New(
qrcodekit.Content(payload.URL("https://example.com")),
qrcodekit.WithModuleStyle(style.ModuleStyle{
Shape: style.ShapeRounded,
BorderRadius: 0.4,
Gradient: style.LinearGradient(
color.RGBA{0, 0, 255, 255},
color.RGBA{0, 255, 255, 255},
style.GradientDiagonal,
),
}),
)
svgData, _ := qr.SVG(512)Add your brand logo with ease. The library automatically handle error correction levels.
lg, _ := logo.Load("logo.png")
qr, _ := qrcodekit.New(
qrcodekit.Content(payload.URL("https://mysite.com")),
qrcodekit.WithLogo(lg),
qrcodekit.WithColors(color.Black, color.White),
)| Format | Op/s | Latency |
|---|---|---|
| SVG | ~3750 | 0.28ms |
| PNG | ~670 | 2.10ms |
SVG generation is extremely fast and recommended for web/print usage.
The library is designed with interfaces (Renderer, Payload) allowing you to implement custom renderers (e.g., PDF, Canvas) or custom payload types easily.
MIT