Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not decode QR generate from fast_qr example #53

Open
harrystb opened this issue Nov 7, 2023 · 0 comments
Open

Could not decode QR generate from fast_qr example #53

harrystb opened this issue Nov 7, 2023 · 0 comments

Comments

@harrystb
Copy link

harrystb commented Nov 7, 2023

Used the example code:

this is bin/decode.rs

fn main() {
    let img = image::open("in.png").unwrap();
    let decoder = bardecoder::default_decoder();
    let results = decoder.decode(&img);
    for result in results {
        println!("{}", result.unwrap());
    }
}

It should decode to https://example.com

I get the error:

thread 'main' panicked at src\bin\decode.rs:6:31:
called `Result::unwrap()` on an `Err` value: Error decoding QR Code: Could not calculate error distances

Here is the QR code.
in

QR code was generated using fast_qr library with the following code:

use fast_qr::convert::ConvertError;
use fast_qr::convert::{svg::SvgBuilder, Builder, Shape};
use fast_qr::qr::QRBuilder;

fn main() -> Result<(), ConvertError> {
    let qrcode = QRBuilder::new("https://example.com/").build().unwrap();

    let _svg = SvgBuilder::default()
        .shape(Shape::Square)
        .to_file(&qrcode, "out.svg");

    Ok(())
}

Then I took a screenshot of the SVG as my method to make it into a PNG file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant