An unexpected error has occurred while saving the webp format.
aidevjoe opened this issue · comments
Did you check the documentation and it did not help?
- I have read the README
- I have searched the existing documentation
- I have searched the existing answer
- I have read the contribution guide
Overview
An error occurred while writing HEIC or WebP format images to the album.
Steps to reproduce
-
Compressing images and setting the output format to Heic or webp using FlutterImageCompress
-
Storing images to the phone album using Gal
-
Gal error: An unexpected error has occurred.
Everything works fine when the output format is jpg or png.
Code sample
Code sample
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
[✓] 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
An unexpected error has occurred.
For support, please do the following
-
rewrite the code to a minimum reproducible code that does not use any package other than Gal or Dio
-
add the platform type where this error occurs
-
get the values of
GalException.platformException
andGalException.platformException.stacktrace
and add them to the log section
Thanks for your contribution.
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.