natsuk4ze / gal

How to Save Image or Video to Photo Gallery in Flutter
https://pub.dev/packages/gal
BSD 3-Clause "New" or "Revised" License
83 stars 12 forks source link

An unexpected error has occurred while saving the webp format. #217

Closed aidevjoe closed 3 months ago

aidevjoe commented 3 months ago

Did you check the documentation and it did not help?

Overview

An error occurred while writing HEIC or WebP format images to the album.

Steps to reproduce

  1. Compressing images and setting the output format to Heic or webp using FlutterImageCompress

  2. Storing images to the phone album using Gal

  3. Gal error: An unexpected error has occurred.

Everything works fine when the output format is jpg or png.

Code sample

Code sample ```dart final result = await FlutterImageCompress.compressWithFile( file.absolute.path, minWidth: image.width, minHeight: image.height, quality: quality, keepExif: keepExif, format: CompressFormat.webp); if (result == null) { continue; } final hasAccess = await Gallery.shared.requestAccess(); if (!hasAccess) { return; } try { await Gallery.shared.putImageBytes(result); HUD.showToast("Saved."); HUD.dismissDialog(); } on GalException catch (e) { HUD.showToast(e.type.message); HUD.dismissDialog(); } catch (e) { HUD.showToast(e.toString()); HUD.dismissDialog(); } ```

Environment

Logs ```console [✓] Flutter (Channel stable, 3.19.3, on macOS 13.6 22G120 darwin-arm64, locale zh-Hans-CN) • Flutter version 3.19.3 on channel stable at /opt/homebrew/Caskroom/flutter/3.16.5/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ba39319843 (7 days ago), 2024-03-07 15:22:21 -0600 • Engine revision 2e4ba9c6fb • Dart version 3.3.1 • DevTools version 2.31.1 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/joe/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.0) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15A240d • CocoaPods version 1.14.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.2) • 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 17.0.6+0-17.0.6b802.4-9586694) [✓] VS Code (version 1.87.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.84.0 [✓] Connected device (4 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator) • Joe (mobile) • 00008110-001670882E42801E • ios • iOS 17.1 21B74 • macOS (desktop) • macos • darwin-arm64 • macOS 13.6 22G120 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.129 [✓] Network resources • All expected network resources are available. • No issues found! ```

Logs

Logs ```console An unexpected error has occurred. ```
natsuk4ze commented 3 months ago

For support, please do the following

  1. rewrite the code to a minimum reproducible code that does not use any package other than Gal or Dio

  2. add the platform type where this error occurs

  3. get the values of GalException.platformException and GalException.platformException.stacktrace and add them to the log section

Thanks for your contribution.

github-actions[bot] commented 3 months ago

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. If you find this problem please file a new issue with the same description, Thanks for your contribution.