根据源码,压缩图片仅支持JPEG
根据这个讨论https://discussions.apple.com/thread/8319465 https://discussions.apple.com/thread/8319465
All photos taken with the camera will be JPG, unless you go to Settings/Camera - Formats and choose High Efficiency. But High Efficiency will make the photos HEIF,
所以你可以用这个参考检查你的相机设置https://www.mactrast.com/2017/10/set-iphones-camera-back- saving-photos-jpeg-ios-11/ https://www.mactrast.com/2017/10/set-iphones-camera-back-saving-photos-jpeg-ios-11/
iOS部分
https://github.com/flutter/plugins/blob/master/packages/image_picker/ios/Classes/FLTImagePickerMetaDataUtil.m https://github.com/flutter/plugins/blob/master/packages/image_picker/ios/Classes/FLTImagePickerMetaDataUtil.m
(NSData *)convertImage:(UIImage *)image
usingType:(FLTImagePickerMIMEType)type
quality:(nullable NSNumber *)quality {
if (quality && type != FLTImagePickerMIMETypeJPEG) {
NSLog(@"image_picker: compressing is not supported for type %@. Returning the image with "
@"original quality",
[FLTImagePickerMetaDataUtil imageTypeSuffixFromType:type]);
}
省镖部分https://github.com/flutter/plugins/blob/master/packages/image_picker/lib/image_picker.dart https://github.com/flutter/plugins/blob/master/packages/image_picker/lib/image_picker.dart
/// The `imageQuality` argument modifies the quality of the image, ranging from 0-100
/// where 100 is the original/max quality. If `imageQuality` is null, the image with
/// the original quality will be returned. 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.