makiuchi-d / gozxing

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

cannot decode a qrcode #13

Closed athsx closed 5 years ago

athsx commented 5 years ago

I try to decode a qrcode, but I cannot decode it. it give me a error

NotFoundException

but actully it is a normal qrcode, this is my pic. QR

that my code:

func DecodeFile(fi string)(string, error) {
    file, _ := os.Open(fi)
    img, _, _:= image.Decode(file)
    // prepare BinaryBitmap
    bmp, _:= gozxing.NewBinaryBitmapFromImage(img)
    // decode image
    result, err := qrcode.NewQRCodeReader().Decode(bmp, nil)
    if err != nil {
        return "", err
    }
    return result.String(), nil
}
makiuchi-d commented 5 years ago

That qrcode is distorted. There is 3px width modules and 4px width modules.

This is fixed image: qrcode11fix

athsx commented 5 years ago

thank you!!