Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

gozxing

> 编程语言
Open source

Port of ZXing (https://github.com/zxing/zxing) core to pure Go.

665 stars0 likes0 views
WebsiteGitHub

About

Port of ZXing (https://github.com/zxing/zxing) core to pure Go.

gozxing A Barcode Scanning/Encoding Library for Go

ZXing is an open-source, multi-format 1D/2D barcode image processing library for Java. This project is a port of ZXing core library to pure Go.

Porting Status (supported formats)

2D barcodes

Format Scanning Encoding
QR Code :heavy_check_mark: :heavy_check_mark:
Data Matrix :heavy_check_mark: :heavy_check_mark:
Aztec :heavy_check_mark:
PDF 417
MaxiCode

1D product barcodes

Format Scanning Encoding
UPC-A :heavy_check_mark: :heavy_check_mark:
UPC-E :heavy_check_mark: :heavy_check_mark:
EAN-8 :heavy_check_mark: :heavy_check_mark:
EAN-13 :heavy_check_mark: :heavy_check_mark:

1D industrial barcode

Format Scanning Encoding
Code 39 :heavy_check_mark: :heavy_check_mark:
Code 93 :heavy_check_mark: :heavy_check_mark:
Code 128 :heavy_check_mark: :heavy_check_mark:
Codabar :heavy_check_mark: :heavy_check_mark:
ITF :heavy_check_mark: :heavy_check_mark:
RSS-14 :heavy_check_mark: -
RSS-Expanded

Special reader/writer

Reader/Writer Porting status
MultiFormatReader
MultiFormatWriter
ByQuadrantReader
GenericMultipleBarcodeReader
QRCodeMultiReader :heavy_check_mark:
MultiFormatUPCEANReader :heavy_check_mark:
MultiFormatOneDReader

Usage Examples

Scanning QR code

package main

import (
	"fmt"
	"image"
	_ "image/jpeg"
	"os"

	"github.com/makiuchi-d/gozxing"
	"github.com/makiuchi-d/gozxing/qrcode"
)

func main() {
	// open and decode image file
	file, _ := os.Open("qrcode.jpg")
	img, _, _ := image.Decode(file)

	// prepare BinaryBitmap
	bmp, _ := gozxing.NewBinaryBitmapFromImage(img)

	// decode image
	qrReader := qrcode.NewQRCodeReader()
	result, _ := qrReader.Decode(bmp, nil)

	fmt.Println(result)
}

Generating CODE128 barcode

package main

import (
	"image/png"
	"os"

	"github.com/makiuchi-d/gozxing"
	"github.com/makiuchi-d/gozxing/oned"
)

func main() {
	// Generate a barcode image (*BitMatrix)
	enc := oned.NewCode128Writer()
	img, _ := enc.Encode("Hello, Gophers!", gozxing.BarcodeFormat_CODE_128, 250, 50, nil)

	file, _ := os.Create("barcode.png")
	defer file.Close()

	// *BitMatrix implements the image.Image interface,
	// so it is able to be passed to png.Encode directly.
	_ = png.Encode(file, img)
}

Thread Safety

Starting from version v0.1.2, BinaryBitmap and HybridBinarizer are thread-safe for concurrent access. Multiple goroutines can safely call GetBlackMatrix() on the same instance without external synchronization.

Why This Matters

Creating a BinaryBitmap from an image can be computationally significant. For high-performance services, caching these preprocessed bitmaps can offer tangible benefits.

Performance Benchmarks

The following benchmark demonstrates why caching BinaryBitmap instances is valuable:

…

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Go2d-barcodesbarcodesgolangqrcode-generator

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言