Mariovc / ImagePicker

Android library to easily pick an image from gallery or camera app. The users can select their prefered gallery/camera app on a unique Intent. Initial gist:
https://gist.github.com/Mariovc/f06e70ebe8ca52fbbbe2
Apache License 2.0
158 stars 52 forks source link

Add InputStream access in addition to Bitmap access to returned image #18

Closed jfinkhaeuser closed 7 years ago

jfinkhaeuser commented 7 years ago

When your goal in image picking isn't to display the image immediately, but to do something with it (e.g. upload somewhere), there's no need to use up all the memory for loading an image file into a Bitmap instance.

This is especially true as many APIs allow streaming access precisely to avoid huge memory overhead.

This addition returns an InputStream instead of a Bitmap (but is otherwise functionally equivalent). InputStream is what you can get from ContentResolver for e.g. gallery access, and from the temporary file written by the camera access, so makes for the best interface here.

Mariovc commented 7 years ago

Thank you for your contribution. Nice!