makiuchi-d / gozxing

Port of ZXing (https://github.com/zxing/zxing) core to pure Go.
Other
549 stars 66 forks source link

notFoundException on a valid QR images #70

Open LindyLo opened 1 month ago

LindyLo commented 1 month ago

Hello

I have a "collection" of QR images that cause following errors when I try to decode them :

%!w(gozxing.notFoundException={{NotFoundException {{NotFoundException {{NotFoundException: (w, h) = (512, 512), (x, y) = (536, -26) {[4376226640 4376226469 4376225072]}}} {[4376225217 4376225381 4376305616]}}} {[4376304089 4376304265 4376302624]}}})panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x104d974e0]

The code I'm using to try and decode :

        img, err := png.Decode(file)
        if err != nil {
            fmt.Printf("Error decoding PNG image: %v\n", err)
            break
        }

        bmp, err := gozxing.NewBinaryBitmapFromImage(img)
        if err != nil {
            fmt.Printf("%w", err)
        }

        qrReader := gozxingQR.NewQRCodeReader()
        r, err := qrReader.Decode(bmp, nil)
        if err != nil {
            fmt.Printf("%w", err)
        }

I'm including 3, but I can provide more if needed.

bc1qw4yf73y40mql98up986at64qmkxy6rfqqnh0wn

KwZP8JWwNCMk8hBwCNMggTsTqonPfSTYQtcrvXyoYQnVgwtLX72M

KxzYQuYqTzmAbgxQaJFNMxeruwqE1Es7bwNEXrE7twsSKwLbjRFs

makiuchi-d commented 1 month ago

Try with DecodeHintType_PURE_BARCODE.