Skip to content

image_picker logs Exception when trying to select a PNG image using maxWidth and maxHeight #64999

@sceee

Description

@sceee

Steps to Reproduce

  1. Use image_picker 0.6.7+7 plugin
  2. Pick a .png image from locally or Google Drive using the following code
    final picker = ImagePicker();
    final pickedFile = await picker.getImage(
      source: imgSource,
      maxWidth: 2048.0,
      maxHeight: 2048.0,
    );

    if (pickedFile != null) {
      final imageBytes = await pickedFile.readAsBytes();
    }

Expected results: Image is picked correctly, no Exception is logged. Docs say that Compression is only supportted for certain image types such as JPEG. If compression is not supported for the image that is picked, an warning message will be logged. but as I'm not using the compression setting, I am wondering why the following exception is logged.

Actual results: Image is picked but Exception is also logged.

Invalid image: ExifInterface got an unsupported image format file(ExifInterface supports JPEG and some RAW image formats only) or a corrupted JPEG file to ExifInterface.
W/ExifInterface(21725): Invalid image: ExifInterface got an unsupported image format file(ExifInterface supports JPEG and some RAW image formats only) or a corrupted JPEG file to ExifInterface.
W/ExifInterface(21725): java.io.IOException: Invalid byte order: ffff8950
W/ExifInterface(21725): 	at android.media.ExifInterface.readByteOrder(ExifInterface.java:3121)
W/ExifInterface(21725): 	at android.media.ExifInterface.isOrfFormat(ExifInterface.java:2437)
W/ExifInterface(21725): 	at android.media.ExifInterface.getMimeType(ExifInterface.java:2315)
W/ExifInterface(21725): 	at android.media.ExifInterface.loadAttributes(ExifInterface.java:1753)
W/ExifInterface(21725): 	at android.media.ExifInterface.initForFilename(ExifInterface.java:2297)
W/ExifInterface(21725): 	at android.media.ExifInterface.<init>(ExifInterface.java:1384)
W/ExifInterface(21725): 	at io.flutter.plugins.imagepicker.ExifDataCopier.copyExif(ExifDataCopier.java:15)
W/ExifInterface(21725): 	at io.flutter.plugins.imagepicker.ImageResizer.copyExif(ImageResizer.java:120)
W/ExifInterface(21725): 	at io.flutter.plugins.imagepicker.ImageResizer.resizeImageIfNeeded(ImageResizer.java:49)
W/ExifInterface(21725): 	at io.flutter.plugins.imagepicker.ImagePickerDelegate.handleImageResult(ImagePickerDelegate.java:556)
W/ExifInterface(21725): 	at io.flutter.plugins.imagepicker.ImagePickerDelegate.handleChooseImageResult(ImagePickerDelegate.java:492)
W/ExifInterface(21725): 	at io.flutter.plugins.imagepicker.ImagePickerDelegate.onActivityResult(ImagePickerDelegate.java:471)
W/ExifInterface(21725): 	at io.flutter.embedding.engine.FlutterEnginePluginRegistry$FlutterEngineActivityPluginBinding.onActivityResult(FlutterEnginePluginRegistry.java:691)
W/ExifInterface(21725): 	at io.flutter.embedding.engine.FlutterEnginePluginRegistry.onActivityResult(FlutterEnginePluginRegistry.java:378)
W/ExifInterface(21725): 	at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult(FlutterActivityAndFragmentDelegate.java:619)
W/ExifInterface(21725): 	at io.flutter.embedding.android.FlutterActivity.onActivityResult(FlutterActivity.java:584)
W/ExifInterface(21725): 	at android.app.Activity.dispatchActivityResult(Activity.java:8110)
W/ExifInterface(21725): 	at android.app.ActivityThread.deliverResults(ActivityThread.java:4838)
W/ExifInterface(21725): 	at android.app.ActivityThread.handleSendResult(ActivityThread.java:4886)
W/ExifInterface(21725): 	at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
W/ExifInterface(21725): 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
W/ExifInterface(21725): 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
W/ExifInterface(21725): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
W/ExifInterface(21725): 	at android.os.Handler.dispatchMessage(Handler.java:107)
W/ExifInterface(21725): 	at android.os.Looper.loop(Looper.java:214)
W/ExifInterface(21725): 	at android.app.ActivityThread.main(ActivityThread.java:7356)
W/ExifInterface(21725): 	at java.lang.reflect.Method.invoke(Native Method)
W/ExifInterface(21725): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
W/ExifInterface(21725): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
[√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.18363.1016], locale de-DE)
    • Flutter version 1.20.2 at C:\Dev\flutter
    • Framework revision bbfbf1770c (3 weeks ago), 2020-08-13 08:33:09 -0700
    • Engine revision 9d5b21729f
    • Dart version 2.9.1

 
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Users\...\AppData\Local\Android\sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 48.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.48.2)
    • VS Code at C:\Users\...\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.13.2

[√] Connected device (1 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: crashStack traces logged to the consolee: OS-version specificAffects only some versions of the relevant operating systemfound in release: 1.22Found to occur in 1.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: image_pickerThe Image Picker plugin.packageflutter/packages repository. See also p: labels.platform-androidAndroid applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions