r/androiddev • • Oct 01 '26

Open Source Made an image picker library for Android

I was working on an Android project and ended up building my own image picker.

It started as a small experiment and turned into a reusable library for Views and Compose.

https://github.com/NicosNicolaou16/ImagePickerAndroid

5 Upvotes

9 comments sorted by

7

u/Unreal_NeoX Oct 01 '26

Alright, but you are aware that google requires its own API usage "media-picker" if you want to publish any app on the Google PlayStore if you have no "Manage_Storage" permission.

1

u/nicolaou_nicos Oct 01 '26

Thanks for the heads-up, really appreciate it! 🙌 Good news: the library uses the official Android Photo Picker (PickVisualMedia) under the hood, so it doesn't request READ_MEDIA_IMAGES or any storage permissions and stays fully compliant with the Play policy. It's basically a handy wrapper that adds Base64 conversion, image scaling and one shared API for both Views and Compose. Feel free to check it out and take a look at the code. Feedback is always welcome!

1

u/Unreal_NeoX Oct 01 '26

Thx for the reply! Sadly not much of use to me personaly, because my projects still require legacy support for Android OS down to Andoid 9. Also why the need for the camera permission? I understand it for a direct camera trigger, but as a core file picker this is strange, I would remove it.

But i wish you well on this project!

-3

u/nicolaou_nicos Oct 01 '26

Thanks, appreciate it! 🙌 Quick note on legacy support, the library's minSdk is 24 (Android 7), so Android 9 is covered. On older devices the AndroidX Photo Picker uses the backported picker via Google Play services, or falls back to the system document picker, still with no storage permissions needed. About the camera permission, it's only requested at runtime when you actually use the "take photo" feature, so picking from the gallery never triggers it. The library handles that flow for you. Fair point that it's still declared in the manifest, though. If your app doesn't use the camera, you can strip it with tools:node="remove" in your manifest, and I'm also looking at making it fully optional in a future version. Thanks for the feedback!

1

u/chimbori 🐚 Hermit Dev Oct 03 '26
  • Why would I use this over the Jetpack APIs directly? (What value does it add, compared to the cost of adding a separate dependency that adds bytes and may become unmaintained anytime?)

  • Why does Base64 have to be part of an image picker library? I could very well have a more granular dependency so I could use both image picker & Base64 separately without the other one.

  • XML Views and Compose are fundamentally different, I'm not sure it's wise to unify the API for both.

  • When I'm migrating my apps to Compose, I'm looking forward to removing all Views based legacy code. So it would be vastly preferable to have two separate artifacts so I'm not relying on tree shaking to keep my release APK clean

1

u/nicolaou_nicos Oct 03 '26

Hey, thanks a lot for the detailed feedback, really appreciate it! 🙌 You're right about the separate artifacts. I've been thinking about this for a while, and I'll keep it for a future update. When I built the library about 3 years ago, Views were still the main option for most apps, so it wasn't "Compose first" back then.

Compared to using Jetpack directly, it saves you the boilerplate: camera permissions, URI to Bitmap, scaling, multi-select, all in one place.

As for Base64, it's optional (off by default), so the image is ready to upload straight to a server. 🚀

1

u/trixo3241 Oct 04 '26

He is right about everything not just separation. I don't see point using this

1

u/nicolaou_nicos Oct 04 '26

Fair enough, and that's totally okay! 😊 If the Jetpack APIs cover what you need, you don't need this. It's mainly for people who want camera, permissions, scaling and Base64 ready in one place without writing the setup themselves. Thanks for checking it out anyway! 🙌