This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

Expo ImagePicker iconExpo ImagePicker

A library that provides access to the system's UI for selecting images and videos from the phone's library or taking a photo with the camera.

Android
iOS
Web
Included in Expo Go
Recommended version:
~56.0.25

expo-image-picker provides access to the system's UI for selecting images and videos from the phone's library or taking a photo with the camera.

Known issues 
iOS

On iOS, when an image (usually of a higher resolution) is picked from the camera roll, the result of the cropped image gives the wrong value for the cropped rectangle in some cases. Unfortunately, this issue is with the underlying UIImagePickerController due to a bug in the closed-source tools built into iOS.

Installation

Terminal
- npx expo install expo-image-picker
- yarn expo install expo-image-picker
- pnpm expo install expo-image-picker
- bun expo install expo-image-picker

If you are installing this in an existing React Native app, make sure to install expo in your project.

Configuration in app config

You can configure expo-image-picker using its built-in config plugin if you use config plugins in your project (Continuous Native Generation (CNG)). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect. If your app does not use CNG, then you'll need to manually configure the library.

By default expo-image-picker will add RECORD_AUDIO permission on Android. You can remove it by setting the microphonePermission to false in the config below.

Example app.json with config plugin

app.json
{ "expo": { "plugins": [ [ "expo-image-picker", { "photosPermission": "The app accesses your photos to let you share them with your friends.", "colors": { "cropToolbarColor": "#000000" }, "dark": { "colors": { "cropToolbarColor": "#000000" } } } ] ] } }

Configurable properties

NameDefaultDescription
photosPermission"Allow $(PRODUCT_NAME) to access your photos"
Only for: 
iOS

A string to set the NSPhotoLibraryUsageDescription permission message.

cameraPermission"Allow $(PRODUCT_NAME) to access your camera"

A string to set the NSCameraUsageDescription permission message. If value false is provided then CAMERA permission will be blocked on Android.

microphonePermission"Allow $(PRODUCT_NAME) to access your microphone"

A string to set the NSMicrophoneUsageDescription permission message. If value false is provided then RECORD_AUDIO permission will be blocked on Android.

colorsundefined
Only for: 
Android

An object containing color properties for customizing the image picker crop UI in light mode.

colors.cropToolbarColor#00000000
Only for: 
Android

A hex color string for the crop toolbar background color.

colors.cropToolbarIconColor#000000
Only for: 
Android

A hex color string for the crop toolbar icon color.

colors.cropToolbarActionTextColor#000000
Only for: 
Android

A hex color string for the crop toolbar action text color.

colors.cropBackButtonIconColor#000000
Only for: 
Android

A hex color string for the crop toolbar back button icon color.

colors.cropBackgroundColor#ffffff
Only for: 
Android

A hex color string for the crop screen background color.

dark.colors{ cropToolbarColor: "#00000000", cropToolbarIconColor: "#ffffff", cropToolbarActionTextColor: "#ffffff", cropBackButtonIconColor: "#ffffff", cropBackgroundColor: "#000000" }
Only for: 
Android

An object containing color properties for customizing the image picker crop UI in dark mode.

Are you using this library in an existing React Native app?

If you're not using Continuous Native Generation (CNG) or you're using a native ios project manually, then you need to add NSPhotoLibraryUsageDescription, NSCameraUsageDescription, and NSMicrophoneUsageDescription keys to your ios/[app]/Info.plist:

Info.plist
<key>NSPhotoLibraryUsageDescription</key> <string>Give $(PRODUCT_NAME) permission to save photos</string> <key>NSCameraUsageDescription</key> <string>Give $(PRODUCT_NAME) permission to access your camera</string> <key>NSMicrophoneUsageDescription</key> <string>Give $(PRODUCT_NAME) permission to use your microphone</string>

Usage

Image Picker
import { useState } from 'react'; import { Alert, Button, Image, View, StyleSheet } from 'react-native'; import * as ImagePicker from 'expo-image-picker'; export default function ImagePickerExample() { const [image, setImage] = useState<string | null>(null); const pickImage = async () => { // No permissions request is necessary for launching the image library. // Manually request permissions for videos on iOS when `allowsEditing` is set to `false` // and `videoExportPreset` is `'Passthrough'` (the default), ideally before launching the picker // so the app users aren't surprised by a system dialog after picking a video. // See "Invoke permissions for videos" sub section for more details. const permissionResult = await ImagePicker.requestMediaLibraryPermissionsAsync(); if (!permissionResult.granted) { Alert.alert('Permission required', 'Permission to access the media library is required.'); return; } let result = await ImagePicker.launchImageLibraryAsync({ mediaTypes: ['images', 'videos'], allowsEditing: true, aspect: [4, 3], quality: 1, }); console.log(result); if (!result.canceled) { setImage(result.assets[0].uri); } }; return ( <View style={styles.container}> <Button title="Pick an image from camera roll" onPress={pickImage} /> {image && <Image source={{ uri: image }} style={styles.image} />} </View> ); } const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', justifyContent: 'center', }, image: { width: 200, height: 200, }, });

When you run this example and pick an image, you will see the image that you picked show up in your app, and a similar log will be shown in the console:

{ "assets": [ { "assetId": "C166F9F5-B5FE-4501-9531", "base64": null, "duration": null, "exif": null, "fileName": "IMG.HEIC", "fileSize": 6018901, "height": 3025, "type": "image", "uri": "file:///data/user/0/host.exp.exponent/cache/cropped1814158652.jpg" "width": 3024 } ], "canceled": false }

Invoke permissions for videos
iOS

In SDK 54 and later, the default configuration keeps allowsEditing set to false and videoExportPreset set to 'Passthrough'. These settings return the original asset (including HEIC and AVIF files) instantly because the picker skips compression, but iOS requires media library permission to access the original file and displays a permission dialog immediately after the user selects a video.

To avoid showing permissions dialog after selection, manually request media library permissions before opening the picker via requestMediaLibraryPermissionsAsync or useMediaLibraryPermissions.

With AWS S3

AWS storage example

An example of how to use AWS storage can be found in with-aws-storage-upload.

See Amplify documentation guide to set up your project correctly.

With Firebase

Firebase storage example

An example of how to use Firebase storage can be found in with-firebase-storage-upload.

See Using Firebase guide to set up your project correctly.

API

import * as ImagePicker from 'expo-image-picker';

No API data file found, sorry!

Permissions

Android

The following permissions are added automatically through the library's AndroidManifest.xml.

Android permissionDescription

CAMERA

Required to be able to access the camera device.

READ_EXTERNAL_STORAGE

Allows an application to read from external storage.

WRITE_EXTERNAL_STORAGE

Allows an application to write to external storage.

iOS

The following usage description keys are used by the APIs in this library.

Info.plist keyDescription

NSMicrophoneUsageDescription

A message that tells the user why the app is requesting access to the device’s microphone.

NSPhotoLibraryUsageDescription

A message that tells the user why the app is requesting access to the user’s photo library.

NSCameraUsageDescription

A message that tells the user why the app is requesting access to the device’s camera.