react-native-image-picker: [π] Error processing request body: Could not find image file
Description
Error when trying to upload image from gallery

Running the example app of this repo gives me the same issue:
https://user-images.githubusercontent.com/2533919/233574721-ce717d9a-9a00-4f30-b912-483a18f16afd.mp4
How to repeat issue and example
const imagePickerDefaultOptions = {
selectionLimit: 0,
mediaType: 'photo' as MediaType,
includeBase64: false,
includeExtra: true,
};
launchImageLibrary(imagePickerDefaultOptions, (imgPickerResponse) => {
if (imgPickerResponse.assets?.[0]) {
onPhotoTaken(imgPickerResponse.assets?.[0]);
}
});
Solution
What needs to be done to address this issue?
Additional Information
- Image Picker version: >=4.10.3
- React Native version: 0.66.1 and 0.71.2
- Platform: iOS
- Development Operating System: MacOS
- Dev tools: Xcode 14.0.1, iOS 16.0
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 6
- Comments: 27
Seems to only happen for me on the sim flower image (the one picked in the video above), which is marked as
HDRand has image type ofHEICwhen viewed in the photos app@dmsierra11 I believe the problem is here.
Successfully selected image:
Error selected image:
In other words, the
heightandwidthattributes are coming with0and thefileSizeis not coming, which is causing this problem.Use
react-native-image-crop-pickerI had the same issue I believe its crashing for the image which are not available like the one that are on cloud. Once the cloud image is downloaded it does not crash.
Looking at @samcodefish PR and from my understanding of the problem, it seems that .heic files cannot be handled like .jpg files. When selecting a .heic file, the copy that you can access from launchImageLibrary response is a .jpg file (at least it is what I find in uri property) and that is why height, width, type and fileSize are wrong and you canβt access it.
Unfortunately, your PR does not correct this behavior, I still got uri to a .jpg file that result in a bug (βCould not find image β¦β)
I just want to add that to get to this conclusion, I only used the .heic image from the iPhone 12 mini - iOS 16.2 emulator, the one that display flowers. Maybe it is different with a real device or with different images
EDIT: It seems that
I tried with an other heic file and it works fine (on simulator). Thanks Apple I guess π
(source https://developer.apple.com/forums/thread/699155?answerId=702819022#702819022)
I had a similar encounter with a captivating sunflower image. If anyone else has experienced this issue with different images, I would greatly appreciate it if you could kindly share your observations.