ImageManipulator manipulateAsync Crop is not working on Android SDK 32.0.0
See original GitHub issue🐛 Bug Report
ImageManipulator.manipulateAsync
passing Crop function with valid parameter is throwing error: "Invalid crop options has been passed. Please make sure the requested crop rectangle is inside source image."
Environment
Expo CLI 2.10.1 environment info:
System:
OS: Windows 10
Binaries:
Yarn: 1.13.0 - C:\Users\tirad\AppData\Roaming\npm\yarn.CMD
npm: 6.7.0 - C:\Program Files\nodejs\npm.CMD
Targeting Android on Expo App Current Issue found running on a Samsung S8+ and Samsung J2 Prime
Steps to Reproduce
Take picture using the following Snack:
https://snack.expo.io/@johnnietirado/android-crop-camera-issue
- Click Camera Button, accept use of Camera.
- Click Button at bottom of screen.
- Original Image will be shown but not cropped correctly.
Expected Behavior
Image should be cropped correctly like a card. About a third of the height of the image and grabbing the center third.
Actual Behavior
Image is not cropped and error is thrown
Error: "Invalid crop options has been passed. Please make sure the requested crop rectangle is inside source image." in h@/data/user/0/host.exp.exponent/files/32.0.0/cached-bundle-experience-%40johnnietirado%2Fandroid-crop-camera-issue281302753-32.0.0:38:1566 << /data/user/0/host.exp.exponent/files/32.0.0/cached-bundle-experience-%40johnnietirado%2Fandroid-crop-camera-issue281302753-32.0.0:38:960 << value@/data/user/0/host.exp.exponent/files/32.0.0/cached-bundle-experience-%40johnnietirado%2Fandroid-crop-camera-issue281302753-32.0.0:46:3650 << /data/user/0/host.exp.exponent/files/32.0.0/cached-bundle-experience-%40johnnietirado%2Fandroid-crop-camera-issue281302753-32.0.0:46:1155 ...
Reproducible Demo
https://snack.expo.io/@johnnietirado/android-crop-camera-issue
Notes
I found where the error is being throw in the code: File
Line 121 has the logic which checks for correct dimensions
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:14 (4 by maintainers)
I’m getting this also. Looks like it’s some sort of multiply by 2 issue.
I was able to work around it by dividing originX, originY, width and, height all by 2.
This gives me 90% width and 20% height with it being centered on the original photo.
You make a good point. We’ve been tracking it internally but we should definitely do a better job of making sure bugs are publicly known and can be followed along by the public. We usually try to make sure most things that can be public-facing are but I fell short here haha. I’ll be sure to ping you when we have an update on the fix.