expo-image-picker
Version: 55.0.6 Provides access to the system’s UI for selecting images and videos from the phone’s library or taking a photo with the camera. Supports image editing, multiple selection, and customizable media types.Installation
Usage
API Reference
Methods
(options?: ImagePickerOptions) => Promise<ImagePickerResult>
Opens the system UI for choosing an image or video from the library
(options?: ImagePickerOptions) => Promise<ImagePickerResult>
Opens the system camera for taking a photo or video
() => Promise<CameraPermissionResponse>
Requests camera permissions from the user
() => Promise<CameraPermissionResponse>
Checks current camera permission status
(writeOnly?: boolean) => Promise<MediaLibraryPermissionResponse>
Requests media library permissionsParameters:
writeOnly(boolean): Request write-only permissions. Defaults tofalse
(writeOnly?: boolean) => Promise<MediaLibraryPermissionResponse>
Checks current media library permission status
() => Promise<ImagePickerResult | null>
Retrieves pending result on Android when MainActivity is destroyed
Hooks
() => [PermissionResponse | null, () => Promise<PermissionResponse>, () => Promise<PermissionResponse>]
Hook for camera permissions
(options?: { writeOnly?: boolean }) => [PermissionResponse | null, () => Promise<PermissionResponse>, () => Promise<PermissionResponse>]
Hook for media library permissions
Types
ImagePickerOptions
MediaTypeOptions
Type of media to select. Values:
All, Images, Videosboolean
Whether to show editing UI after selection. Defaults to
falseboolean
Allow selecting multiple items. Defaults to
false[number, number]
Aspect ratio for editing (e.g.,
[4, 3])number
Image quality (0 to 1). Defaults to
0.2number
Maximum video duration in seconds
UIImagePickerControllerQualityType
Video quality:
0 (High), 1 (Medium), 2 (Low)boolean
Include EXIF data. Defaults to
falseboolean
Include base64 representation. Defaults to
falseImagePickerResult
ImagePickerAsset
string
URI of the selected media
number
Width in pixels
number
Height in pixels
'image' | 'video'
Media type
string | null
Original file name
number
File size in bytes
object
EXIF metadata (if requested)
string
Base64 data (if requested)
number
Video duration in milliseconds
Enums
Examples
Pick Image from Library
Take Photo with Camera
Select Multiple Images
Pick Video with Editing
Get Image with EXIF Data
Complete Example with Permissions
Platform Support
Permissions
iOS
Add toapp.json:
Android
Permissions are automatically added:READ_EXTERNAL_STORAGE/READ_MEDIA_IMAGES/READ_MEDIA_VIDEOWRITE_EXTERNAL_STORAGE(Android < 10)CAMERA
Best Practices
- Always Request Permissions: Check and request permissions before launching picker
- Quality Settings: Use
quality: 1for profile photos, lower for thumbnails - Handle Cancellation: Always check
result.canceledbefore accessing assets - Memory Management: Be cautious with
base64on large images - Multiple Selection: Don’t use
allowsEditingwithallowsMultipleSelection
On Android, if the system kills the activity, use
getPendingResultAsync() to recover the selection. Test by enabling “Don’t keep activities” in developer options.