If you’re building apps using Kotlin Multiplatform or Jetpack Compose — and you need to take photos or select images from the gallery — ImagePickerKMP is the library you’ve been waiting for.

It works seamlessly on Android and iOS, supports both Jetpack Compose Multiplatform and Android Native, and gives you full control over camera access, gallery selection, and UI customization.

What is ImagePickerKMP?

ImagePickerKMP is an open-source Kotlin Multiplatform library that lets you:

It’s built for developers who want simplicity, flexibility, and true multiplatform behavior.

Using ImagePickerKMP in Kotlin Multiplatform / Compose Multiplatform

Step 1: Add the dependency

In your commonMain build.gradle.kts:

implementation("io.github.ismoy:imagepickerkmp:1.0.1")

Don’t forget to configure iOS-specific permissions in your Info.plist file:

<key>NSCameraUsageDescription</key>
<string>We need access to the camera to capture a photo.</string>

Step 2: Launch the Camera

 var showCamera by remember { mutableStateOf(false) }
 var capturedPhoto by remember { mutableStateOf<CameraPhotoHandler.PhotoResult?>(null) }
if (showCamera) {
    ImagePickerLauncher(
        context = context, // Take a context in your App.kt
        config = ImagePickerConfig(
            onPhotoCaptured = { result ->
                capturedPhoto = result
                showCamera = false
            },
            onError = {
                showCamera = false
            }
        )
    )
}

Button(onClick = { showCamera = true }) {
    Text("Take Photo")
}
var showGallery by remember { mutableStateOf(false) }
var selectedImages by remember { mutableStateOf<List<GalleryPhotoHandler.PhotoResult>>(emptyList()) }
if (showGallery) {
    GalleryPickerLauncher(
        context = context, // Take a context in your App.kt
        onPhotosSelected = { photos ->
            selectedImages = photos
            showGallery = false
        },
        onError = { error ->
            showGallery = false
        },
        allowMultiple = true, // False for single selection
        mimeTypes = listOf("image/jpeg", "image/png") // Optional: filter by type
    )
}

Button(onClick = { showGallery = true }) {
    Text("Choose from Gallery")
}

For more customization (confirmation views, MIME filtering, etc.), check out the integration guide for KMP.

Using ImagePickerKMP in Android Native (Jetpack Compose)

Even if you’re not using KMP, you can use ImagePickerKMP in pure Android projects with Jetpack Compose.

Step 1: Add the dependency

implementation("io.github.ismoy:imagepickerkmp:1.0.1")

Step 2: Camera Launcher Example

var showCamera by remember { mutableStateOf(false) }
var capturedPhoto by remember { mutableStateOf<CameraPhotoHandler.PhotoResult?>(null) }
val context = LocalContext.current
if (showCamera) {
    ImagePickerLauncher(
        context = context,
        config = ImagePickerConfig(
            onPhotoCaptured = { result ->
                capturedPhoto = result
                showCamera = false
            },
            onError = {
                showCamera = false
            }
        )
    )
}

Button(onClick = { showCamera = true }) {
    Text("Take Photo")
}
var showGallery by remember { mutableStateOf(false) }
var selectedImages by remember { mutableStateOf<List<GalleryPhotoHandler.PhotoResult>>(emptyList()) }
val context = LocalContext.current
if (showGallery) {
    GalleryPickerLauncher(
        context = context,
        onPhotosSelected = { photos ->
            selectedImages = photos
            showGallery = false
        },
        onError = { error ->
            showGallery = false
        },
        allowMultiple = true, // False for single selection
        mimeTypes = listOf("image/jpeg", "image/png") // Optional: filter by type
    )
}

Button(onClick = { showGallery = true }) {
    Text("Choose from Gallery")
}

See the Android Native integration guide for more usage details.

Why Use It?

GitHub Repository