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

embeddedImage not working #64

Closed
mychaelgo opened this issue Oct 18, 2019 · 10 comments
Closed

embeddedImage not working #64

mychaelgo opened this issue Oct 18, 2019 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@mychaelgo
Copy link

Describe the bug
embeddedImage make qr code can't be scanned.

To Reproduce

QrImage(
      data: '7tMKelemz51hL4Z6Q1ug',
      embeddedImage: Image.asset('assets/images/walk_logo_white.png').image,
);

Expected behavior
User must be able to scan qr code with logo in the center

Screenshots
Screen Shot 2019-10-18 at 09 22 45
Screen Shot 2019-10-18 at 09 31 07

Smartphone (please complete the following information):

  • Device: iPhone5s Simulator
  • OS: iOS12.2
  • Library version : qr_flutter: ^3.0.1
@mychaelgo mychaelgo added the bug Something isn't working label Oct 18, 2019
@lukef
Copy link
Collaborator

lukef commented Oct 18, 2019

I'm not really sure what you want me to do here. Whether the QR code can be scanned is dependent on the scanner and not the generator. The top QR code could be scanned using the software I tried (Samsung S10 Camera). The bottom one didn't work.

You could try manually setting a higher version # and see if that improves the readability.

@mychaelgo
Copy link
Author

ok thank you @lukef

@walterFeng
Copy link

hi, @lukef . I also found the same bug. EmbeddedImage make qr code can't be scanned. this is my code:

    Container(
      width: widget.pageWidth,
      height: 250,
      alignment: Alignment.center,
      child: QrImage(
        backgroundColor: Colors.white,
        data: "http://www.github.com",
        embeddedImage:
        AssetImage("assets/images/icon_logo_white_bg.png"),
        embeddedImageStyle:
        QrEmbeddedImageStyle(size: Size(20, 20)),
        version: QrVersions.auto,
        size: 250,
      ),
    )

when I set embeddedImageStyle to QrEmbeddedImageStyle(size: Size(20, 20)),this is the result:
image
it is work well.

but, when I set embeddedImage gets bigger, Change embeddedImageStyle to QrEmbeddedImageStyle(size: Size(60, 60)) or remove embeddedImageStyle params. The qr code can't be scanned:
image
not working now.

I think the QR code should change (but it doesn't) when 'embeddedImage' gets bigger, otherwise the logo will overwrite the valid information of the QR code, so that the observable part of the QR code cannot be recognized by the scanner, do you think? Look forward to your reply.

@mychaelgo
Copy link
Author

@walterFeng have you try to set error correction level =QrErrorCorrectLevel.H ?

@walterFeng
Copy link

@walterFeng have you try to set error correction level =QrErrorCorrectLevel.H ?

@mychaelgo thank you, It is works for me.

but, When the EmbeddedImage-Size exceeds a certain number (e.g. 100), it will still not be able to scan. How do I know the EmbededImage-Size maximum I can assign?

@mychaelgo
Copy link
Author

is the Embedded Image size cover > 30% of the Qr Code?

@walterFeng
Copy link

is the Embedded Image size cover > 30% of the Qr Code?

got it. It is works for me when the Embedded Image size cover < 30%. thank you @mychaelgo

@rehmmann
Copy link

rehmmann commented Jul 3, 2022

Wrapping QrImage in a container worked for me

Container(
              decoration: const BoxDecoration(
                image: DecorationImage(
                    image: AssetImage('assets/images/name.png'),
                    fit: BoxFit.contain),
              ),
              child: QrImage(
     
            )

@NuskySainudeen
Copy link

This code worked for me with embedded Image

QrImage(
  data: "Hello World",
  size: 180,
  embeddedImage: const AssetImage('assets/images/my_image.png'),
  embeddedImageStyle: QrEmbeddedImageStyle(
  size: const Size(45, 57),
  ),
   gapless: false,
)

@mrclauss
Copy link

mrclauss commented Dec 2, 2023

If anybody stumbles across this same problem, just like me...:
The trick is NOT to specify a size for the embedded image, then its size relative to the QR code always remains the same...

Unfortunately this isn't mentioned anywhere in the documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants