gev2002 / react-native-vision-camera-text-recognition

https://www.npmjs.com/package/react-native-vision-camera-text-recognition
MIT License
45 stars 7 forks source link

when passing image path to the function PhotoRecognizer this error is coming #6

Closed rajaneeshvommi closed 4 months ago

rajaneeshvommi commented 4 months ago

Hi, I trying to get the data from the image using the PhotoRecognizer but something is wrong with the image resizer please see the below screenshot for detail error Screenshot_1718959117

click event code const pickImageFromGallery = async () => { const result = await launchImageLibrary({ mediaType: 'photo', quality: 1 }); if (result.assets && result.assets.length > 0) { const { uri, width, height } = result.assets[0]; console.log(uri,"image path"); const result2 = await PhotoRecognizer({ uri: uri, widths: width, height: height }) console.log(result2, "result2"); } };

used dependencies "dependencies": { "@bam.tech/react-native-image-resizer": "^3.0.10", "react": "18.2.0", "react-native": "0.74.2", "react-native-image-picker": "^7.1.2", "react-native-vision-camera": "^4.3.2", "react-native-vision-camera-text-recognition": "^3.0.2", "react-native-worklets-core": "^1.3.3" }

thanks in advance

rajaneeshvommi commented 4 months ago

I have tried another example it started working but the text is not showing up it say the possible unhandled promise rejection i:0 Error : error processing image warning ![Uploading Screenshot_1718961841.png…]()

gev2002 commented 4 months ago

In first variant you are written wrong prop name should be width not widths. Now I change the logic of the module width and height are no longer necessary, instead you can use orientation for iOS

rajaneeshvommi commented 4 months ago

@gev2002 Thank you. sorry about the typo of width, sure I will try and let you know.