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

iOS analyzeImage from gallery not working #967

Open
Awais-ishaq opened this issue Feb 28, 2024 · 12 comments
Open

iOS analyzeImage from gallery not working #967

Awais-ishaq opened this issue Feb 28, 2024 · 12 comments

Comments

@Awais-ishaq
Copy link

iOS analyzeImage from gallery not working, always returns false

@navaronbracke
Copy link
Collaborator

Could you provide the version of mobile_scanner that you use, and a minimal reproducible sample?
Please also include the file from the gallery that you are trying to analyze.

@bh1270
Copy link

bh1270 commented Mar 22, 2024

3.5.7
Android and iOS analyzeImage from gallery not working

Could you provide the version of mobile_scanner that you use, and a minimal reproducible sample? Please also include the file from the gallery that you are trying to analyze.

@navaronbracke
Copy link
Collaborator

Could you also provide a sample file that isn't working with analyzeImage() ?

@navaronbracke
Copy link
Collaborator

With a "sample file", I meant an image that has some kind of barcode in it that was not detected. The above images definitely do not have a barcode at all, so the result is working as intended for those.

@bh1270
Copy link

bh1270 commented Mar 24, 2024

I ran example, but did not recognize my QR code

图片
图片
图片

@Cheng455153666
Copy link

The same issue.

when I use qr_flutter, and generate a qr image.

QrImageView(
  data: '[1234567890](https://github.com/juliansteenbakker/mobile_scanner/issues/967)',
  version: QrVersions.auto,
  gapless: false, // important
  size: 200.0,
),

use RepaintBoundary to get snapshot.
analyzeImage

@navaronbracke Thanks

@ahmedosman2001
Copy link

I'm experiencing the same issue. When I generate a QR code using pretty_qr_code.dart or other libraries on the same phone, the analyzeImage() function fails to recognize it (e.g "No barcode found!" ). However, QR code images I download from the internet work perfectly. I thought the package im using to generate the QR code generation was the problem, but I've tried multiple generators with the same result. I even set a white background to rule out issues with transparent QR images, but that didn't make a difference either. Are there any other potential solutions to this problem?

By the way im using https://github.com/juliansteenbakker/mobile_scanner/blob/c0ac2453e303c9374228076810bb52732e928a11/example/lib/scanner_button_widgets.dart#L5:L49

@debdeep0206
Copy link

I am experiencing the same issue on iOS, it works perfectly on Android. The QR code has been generated using the QR Flutter package.

The analyzeImage() API does not return any QR code when the file is read from the gallery.

Is there any solution to this ?

@isamitchell
Copy link

Could you provide the version of mobile_scanner that you use, and a minimal reproducible sample? Please also include the file from the gallery that you are trying to analyze.

Hello, I am having this same error, the reader stopped reading the images from the gallery, the path that I am passing as an argument is /private/var/mobile/Containers/Data/Application/2A5D7976-D4C1-4576-9CB2-63FA19794306/ tmp/image_picker_BC16B31F-1CDF-47B4-9C25-317BA992F31F-1678-000000DAD48F28FE.png
obtained with the ImagePicker package.

I am using version ^4.0.0

@gand0lfi
Copy link

gand0lfi commented Jan 3, 2025

I had the same problem and it happens on PNG images. If you edit or crop the image (get's saved as JPG on iPhone at least) it works!

@Blue-Cheesecake
Copy link

I had the same problem and it happens on PNG images. If you edit or crop the image (get's saved as JPG on iPhone at least) it works!

This works for me (tried edit or crop image in Photos before use analyzeImage . This will turns from PNG to jpg).
So, I thought that saving QR Code image (generated by qr_flutter) to Photos directly with .jpg extension with screenshot to capture QR image and gal to save image to Photos could work as well but it's not.

  Future<void> saveImageToGallery(Uint8List bytes, {String name = 'img.jpg'}) async {
    var canAccess = await Gal.hasAccess(toAlbum: true);

    if (!canAccess) {
      canAccess = await Gal.requestAccess(toAlbum: true);
    }

    if (!canAccess) {
      throw Failure(message: FileMessages.galleryAccessDenied);
    }

    final imagePath = await getTemporaryFile(name, bytes);
    await Gal.putImage(imagePath.path);
  }

@Blue-Cheesecake
Copy link

This issue may be similar as #1271 . The author released this fix in version 7.0.0-beta.4 . I tried it and it's work for me. Hope this help.

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

9 participants