flutter_image_compress icon indicating copy to clipboard operation
flutter_image_compress copied to clipboard

iOS crashed on webp and keep EXIF

Open SuhwanCha opened this issue 3 years ago • 3 comments

iOS crashed when set output format as webp and keepExif: true.

  Future<File> compressAndGetFile(String targetPath) async {
    final result = await FlutterImageCompress.compressWithFile(
      file.absolute.path,
      quality: 50,
      format: CompressFormat.webp,
      keepExif: true, // it works if false, crashed if true
    );

    if (result == null) {
      throw CompressFailedException();
    }

    return File.fromRawPath(result);
  }
image
  • iOS problem reports log https://gist.github.com/SuhwanCha/57ff6c25608cd30f508a836b9cfa2bdf
flutter doctor -v
❯ flutter doctor -v
[✓] Flutter (Channel unknown, 3.0.5, on macOS 12.5 21G72 darwin-arm, locale en-KR)
    • Flutter version 3.0.5 at /Users/suhwancha/development/GitHub/flutter
    • Upstream repository unknown
    • Framework revision f1875d570e (3 weeks ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /Users/suhwancha/Library/Android/sdk
    • Platform android-32, build-tools 32.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[✓] VS Code (version 1.69.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.46.0

[✓] Connected device (3 available)
    • iPhone 13 Pro (mobile) • 87F95001-8EFB-4419-BB3D-310B6A7FD88F • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
    • macOS (desktop)        • macos                                • darwin-arm64   • macOS 12.5 21G72 darwin-arm
    • Chrome (web)           • chrome                               • web-javascript • Google Chrome 103.0.5060.134

[✓] HTTP Host Availability
    • All required HTTP hosts are available
  • Version of flutter_image_compress
  flutter_image_compress:
    dependency: "direct main"
    description:
      name: flutter_image_compress
      url: "https://pub.dartlang.org"
    source: hosted
    version: "1.1.0"
  • Version of iOS simulator
iPhone 13 Pro (mobile) • 87F95001-8EFB-4419-BB3D-310B6A7FD88F • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)

SuhwanCha avatar Aug 03 '22 06:08 SuhwanCha

Please verify if your exception trace is the same as #213.

AlexV525 avatar Aug 03 '22 08:08 AlexV525

Please verify if your exception trace is the same as #213.

It's different issue, issue you mentioned (#213 ) is about error when try to compress invalid image.

But, this issue happened when try to compress valid image to webp, keep exif.

And, I found same source code and same image works on Android. Only iOS crashed.

SuhwanCha avatar Aug 03 '22 09:08 SuhwanCha

Relative article: https://stackoverflow.com/questions/68802152/unsupported-file-format-org-webmproject-webp-while-saving-cgimage-in-webp-fo

https://github.com/fluttercandies/flutter_image_compress/blob/52cefc9061dabec7197cd93a21c4d3e88aab848c/ios/Classes/SYPictureMetadata/SYMetadata.m#L112-L143

SuhwanCha avatar Dec 15 '22 09:12 SuhwanCha