capacitor-community / image-to-text

Capacitor Plugin for image to text processing (OCR)
Other
28 stars 10 forks source link

How you do it from image file from photo library? #9

Closed onigetoc closed 2 weeks ago

onigetoc commented 7 months ago

Is your feature request related to a problem? Please describe. In Tesseract you have this.getPicture(this.camera.PictureSourceType.PHOTOLIBRARY); this.getPicture(this.camera.PictureSourceType.CAMERA); But nothing here from capacitor.

Describe the solution you'd like Options to choose from photo from Camera or/and Photo Library. And adding base64 images.

HappyKnuckles commented 2 weeks ago

I dont't know if it's still relevant to you. The option to choose from camera OR photo library is achieved if you replace the CameraSource type. const photo = await Camera.getPhoto({quality: 90, allowEditing: true, resultType: CameraResultType.Uri, source: CameraSource.Camera}); Replace source: CameraSource.Camera with source: CameraSource.Prompt and it should work. I didn't test it with ImageToText but as this is the capacitor way to prompt the user between camera and library i am guessing this should work as you are wishing. Documentation on this is here: https://capacitorjs.com/docs/apis/camera#getphoto