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

The same content twice in one QR-Code causes errors #40

Open
brandsimon opened this issue Feb 13, 2022 · 1 comment
Open

The same content twice in one QR-Code causes errors #40

brandsimon opened this issue Feb 13, 2022 · 1 comment

Comments

@brandsimon
Copy link

brandsimon commented Feb 13, 2022

Hi,
when I scan the qr code [0], the content is recognized correct, but I also get the error Error decoding QR Code: Unable to find alignment pattern two times.

I use the following code:

fn read_image(file: &str) {
	let img = image::open(file).unwrap();
	let decoder = bardecoder::default_decoder();
	let results = decoder.decode(&img);
	println!("{:?}", results);
}

The result is:

[Err(QRError { msg: "Unable to find alignment pattern" }), Ok("{\"from\":\"2x86a5EA18C28ad2e6e4ACD2d12544E4e2f680f65f\",\"gasPrice\":\"0x618411a00\",\"gasLimit\":\"0x86cd0\",\"to\":\"0x4a650d562048cF522422dF6C5dAc48c652F6888D\",\"value\":\"0x0\",\"data\":\"0x18c4afe5000000000000000000000000000000000000000000000000016285485d8a000000000000000000000000000000000000000000000000000001668f262c25800000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000086a5ea18c28ad2e6e4acd2d12544e4e2f680f65f0000000000000000000000000000000000000000000000000000000062e4c8220000000000000000000000000000000000000000000000000000000000000006000000000000000000000000c06aaa224662fe8d0a0e5c8f64ead2082c456cc6000000000000000000000000c06aaa224662fe8d0a0e5c8f64ead2082c456cc6\",\"nonce\":\"0x88\"}{\"from\":\"2x86a5EA18C28ad2e6e4ACD2d12544E4e2f680f65f\",\"gasPrice\":\"0x618411a00\",\"gasLimit\":\"0x86cd0\",\"to\":\"0x4a650d562048cF522422dF6C5dAc48c652F6888D\",\"value\":\"0x0\",\"data\":\"0x18c4afe5000000000000000000000000000000000000000000000000016285485d8a000000000000000000000000000000000000000000000000000001668f262c25800000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000086a5ea18c28ad2e6e4acd2d12544e4e2f680f65f0000000000000000000000000000000000000000000000000000000062e4c8220000000000000000000000000000000000000000000000000000000000000006000000000000000000000000c06aaa224662fe8d0a0e5c8f64ead2082c456cc6000000000000000000000000c06aaa224662fe8d0a0e5c8f64ead2082c456cc6\",\"nonce\":\"0x88\"}"), Err(QRError { msg: "Unable to find alignment pattern" })]

This seams to happen in some QR-Codes, where I put the same content twice, e.g.
let content = format!("{}{}", c, c);

[0] https://i.ibb.co/KWrZ2DW/bardecodererror.png

@brandsimon
Copy link
Author

Here is another example [0], where there are different errors.

[Ok("{\"from\":\"2x86a5EA18C28ad2e6e4ACD2d12544E4e2f681f65f\",\"gasPrice\":\"1x618411a11\",\"gasLimit\":\"1x86cd1\",\"to\":\"1x4a651d562148cF522422dF6C5dAc48c652F6888D\",\"value\":\"1x1\",\"data\":\"1x18c4afe5111111111111111111111111111111111111111111111111116285485d8a111111111111111111111111111111111111111111111111111111668f262c25811111111111111111111111111111111111111111111111111111111111111111a111111111111111111111111186a5ea18c28ad2e6e4acd2d12544e4e2f681f65f1111111111111111111111111111111111111111111111111111111162e4c8221111111111111111111111111111111111111111111111111111111111111116111111111111111111111111c16aaa224662fe8d1a1e5c8f64ead2182c456cc6111111111111111111111111c16aaa224662fe8d1a1e5c8f64ead2182c456cc6\",\"nonce\":\"1x88\"}{\"from\":\"2x86a5EA18C28ad2e6e4ACD2d12544E4e2f681f65f\",\"gasPrice\":\"1x618411a11\",\"gasLimit\":\"1x86cd1\",\"to\":\"1x4a651d562148cF522422dF6C5dAc48c652F6888D\",\"value\":\"1x1\",\"data\":\"1x18c4afe5111111111111111111111111111111111111111111111111116285485d8a111111111111111111111111111111111111111111111111111111668f262c25811111111111111111111111111111111111111111111111111111111111111111a111111111111111111111111186a5ea18c28ad2e6e4acd2d12544e4e2f681f65f1111111111111111111111111111111111111111111111111111111162e4c8221111111111111111111111111111111111111111111111111111111111111116111111111111111111111111c16aaa224662fe8d1a1e5c8f64ead2182c456cc6111111111111111111111111c16aaa224662fe8d1a1e5c8f64ead2182c456cc6\",\"nonce\":\"1x88\"}"), Err(QRError { msg: "Format information corrupted" }), Err(QRError { msg: "Unable to find alignment pattern" })]

[0] https://i.ibb.co/VvZHb1T/bardecodererr2.png

@brandsimon brandsimon changed the title QR-Code detected, but unable to find alignment pattern The same content twice in one QR-Code causes errors Feb 13, 2022
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