Skip to content

Could not decode QR generate from fast_qr example #53

@harrystb

Description

@harrystb

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions