Closed Durgeshzibtek closed 1 year ago
I am also getting the above issue in we chat asset picker
cc @CaiJingLong
The file method does not get the picture as it is, but through transcoding, which is a black box of apple system SDK.
The apple developer document about PHImageRequestOptions
and I've annotated the image below, the options used by PhotoManager.
Currently, PhotoManager does not provide an option to change it.
I can only speculate temporarily that the original image may not be stored in JPEG format, but in heic (although it is marked in jpeg format), and the jpeg image of 8000x5000 size should not be only 5MB. You can check the size using originFile.lengthSync of the same file.
My suggestion is to use thumbnailDataWithOption
to get, size can use width
and height
,
ThumbnailOption.ios
provides parameters to modify them.
@CaiJingLong @AlexV525
We tried with the thumbnailDataWithOption but it's loose its original quality if we gave manual height and width.
element.thumbnailDataWithOption(ThumbnailOption.ios(size: const ThumbnailSize(5000, 5000)))
We need the actual size of the file. Because if we fixed the thumbnail Data With Option size width and height then it loses its quality and also for low MB or KB image files it becomes too low again.
Use .originFile
to obtain the raw file regardless of extension, compression, and metadata, e.g. get .heic if the original image is .heic, which is fit for your case.
Regarding the HEIC handling, the plugin can only convert HEIC to JPEG through the .file
getter, you'll need to manipulate the file on your own when using .originFile
or .originBytes
. It's very common that a HEIC compressed image is way smaller than a regular JPEG image, and in this case, 8192×5461 with 45MP camera config should deserve a 22MB's JPEG.
@AlexV525 In our case, .originFile is working fine.
Thank you
When I pick an image from the gallery, I'm getting the File correctly but then I print its file size. I am getting: 22254847 which is about 22Mb. We checked the file size using the print(file.lengthSync()); When I check the image details in the gallery, I see 5.8Mb.
This happens only in the IOS.
Please anyone has a solution regarding this let us know.