fckeuspy-go/vendor/github.com/makiuchi-d/gozxing
2025-09-28 21:03:39 +02:00
..
common feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
qrcode feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
.gitignore feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
barcode_format.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
binarizr.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
binary_bitmap.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
bit_array.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
bit_matrix.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
checksum_exception.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
decode_hint_type.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
dimension.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
encode_hint_type.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
format_exception.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
global_histogram_binarizer.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
go_image_bit_matrix.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
go_image_luminance_source.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
hybrid_binarizer.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
inverted_luminance_source.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
LICENSE feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
luminance_source.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
not_found_exception.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
planar_yuv_luminance_source.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
reader_exception.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
reader.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
README.md feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
result_metadata_type.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
result_point_callback.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
result_point.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
result.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
rgb_luminance_source.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
writer_exception.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00
writer.go feature/ui asi tak vsechno uz funguje pres qr 2025-09-28 21:03:39 +02:00

gozxing A Barcode Scanning/Encoding Library for Go

Build Status codecov

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 ✔️ ✔️
Data Matrix ✔️ ✔️
Aztec ✔️
PDF 417
MaxiCode

1D product barcodes

Format Scanning Encoding
UPC-A ✔️ ✔️
UPC-E ✔️ ✔️
EAN-8 ✔️ ✔️
EAN-13 ✔️ ✔️

1D industrial barcode

Format Scanning Encoding
Code 39 ✔️ ✔️
Code 93 ✔️ ✔️
Code 128 ✔️ ✔️
Codabar ✔️ ✔️
ITF ✔️ ✔️
RSS-14 ✔️ -
RSS-Expanded

Special reader/writer

Reader/Writer Porting status
MultiFormatReader
MultiFormatWriter
ByQuadrantReader
GenericMultipleBarcodeReader
QRCodeMultiReader ✔️
MultiFormatUPCEANReader ✔️
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)
}