NeutrinosPlatform / cordova-plugin-document-scanner

cordova plugin for document scan
https://www.neutrinos.co/
MIT License
85 stars 60 forks source link

Keeping only the needed Image edit options after cropping the image. #60

Closed shreyask12 closed 5 years ago

shreyask12 commented 5 years ago

Is there any way we can give only few image edit options after cropping the image to the user. For example :

  1. User clicks the image.
  2. Then crop the image options appear (edge detection)
  3. Next screen there are edit options such as Rotate left,rotate right,B&W,MAGIC,etc

is there any way we can provide only few edit options out of all this for ex we provide only Magic and rotate options.

I tried to look for any parameters to pass with the options object in the scanDoc()

scan.scanDoc(successCallback, errorCallback,opts); but i cant find any. Please help. eidtOptions

ChrisTomAlx commented 5 years ago

Hey @shreyask12 Currently this isn't possible with the plugin. But it is an interesting feature and I'll add it to our enhancement backlog.

For your immediate use, you could fork the scanlibrary repo in this github account and remove those buttons in the android code manually. If you would like to contribute to this plugin, I will gladly guide / work with you in making the appropriate changes.

Cheers, Chris Neutrinos

shreyask12 commented 5 years ago

Thanks for your reply i would like to contribute to the plugin but for immediate use could you please guide me how to remove those buttons from the android code manually through the scanlibrary.

ChrisTomAlx commented 5 years ago

Hey @shreyask12 If you understand android native code it is pretty straight forward. You can fork the library then just disable the buttons in the xml layout using the android:visibility = "gone" xml property. Then change the build.gradle file in this plugin to point to your fork of the scanlibrary.

Please consider raising a new issue if you are thinking about contributing.

Cheers, Chris Neutrinos

shreyask12 commented 5 years ago

hey Chris, I did as you pointed out in the xml library and disabled the buttons but i am not able to point out to the forked @scanlibrary to the build.gradle. I am still getting the buttons visible even after changing the build.gradle to my forked scanlibrary.

this is my build.gradle after changing

allprojects { repositories { maven { url 'https://jitpack.io' } } }

dependencies { implementation 'com.github.shreyask12:scanlibrary:2.3' }

earlier it was

dependencies { implementation 'com.github.NeutrinosPlatform:scanlibrary:2.3' }

ChrisTomAlx commented 5 years ago

The 2.3 here represents the release version. You have to create a release on github to get that version's build, if not you have to use master-snapshot. Refer to this to get the latest snapshot builds.

Also your current build is failing.

I am assuming you are changing the build.gradle from android studio. Instead you can just change it within your fork of the plugin. Then install that plugin using cordova plugin add https://github.com/shreyask12/cordova-plugin-document-scanner

Cheers, Chris Neutrinos

shreyask12 commented 5 years ago

Thanks @ChrisTomAlx for your help, i achieved what i was looking for with your instructions. But there is still one issue i.e the size of the app increases drastically from 10mb to 45 mb on installing the plugin. i tried the solution provided by you in earlier issue from https://github.com/NeutrinosPlatform/cordova-plugin-document-scanner/issues/45 it reduces the apk size from 45 to 35 mb but my original apk size before installing the plugin was 10mb.

ChrisTomAlx commented 5 years ago

Yea that is expected behavior since we are adding the opencv library to perform image manipulations. opencv is a huge library and this can't be helped. The only advice I can give is to remove some of the other architectures (maybe the 32 bit architectures, although this might cause the app not to work in older phones).

Closing this issue now.

Cheers, Chris Neutrinos