Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support different output formats on iOS #82

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mvanbeusekom
Copy link

First of all thank you for this great plugin, it does an amazing job.

Based on some feedback from our customers, we discovered that in many cases the scans made on iOS devices resulted in far bigger image files when comparing to scanning the same documents on an Android device.

Digging through the code base I quickly realized that this is caused be the different image formats used on the different platforms. On Android all scans are save using the JPEG format, while on iOS scans are saved using the PNG format. Comparing a simple A4 document resulted in a 7.5 MB file on on iOS, while on Android the same scan was only 450 KB in file size.

This PR adds support to supply an instance of the IosScannerOptions to the getPictures method which allows users to specify which format should be used to save scans on iOS. The parameter is optional and if not specified the plugin behaves exactly as the current version.

Example usage:

   // Returns images in PNG format. 
   final imagesPath = await CunningDocumentScanner.getPictures(
      iosScannerOptions: IosScannerOptions(
         imageFormat: IosImageFormat.png,
      ),
   );

   // Returns images in JPEG format with a compression quality of 50%. 
   final imagesPath = await CunningDocumentScanner.getPictures(
      iosScannerOptions: IosScannerOptions(
         imageFormat: IosImageFormat.jpg,
         jpgCompressionQuality: 0.5,
      ),
   );

@mvanbeusekom
Copy link
Author

Hi @jachzen, can you please review this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant