gpt4 book ai didi

image_picker : compressing is not supported for type (null). 返回原始质量的图像

转载 作者:行者123 更新时间:2023-12-05 07:20:31 63 4
gpt4 key购买 nike

我想更改所选图像的图像质量,但出现此错误。有谁知道如何解决这一问题?(我从 iOS 设备上得到了一张图片。)

image_picker:类型(空)不支持压缩。返回原始质量的图像

Future getImageFromCam() async {
File image;
try {
image = await ImagePicker.pickImage(
source: ImageSource.camera, imageQuality: 90);
} on Exception {
_showDialog(context);
}
}

最佳答案

根据源码,压缩图片只支持JPEG格式
根据这个讨论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/

iOS部分

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

 /// 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.

关于image_picker : compressing is not supported for type (null). 返回原始质量的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57472183/

63 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com