Image Picker
The Image Picker action allows users to pick images or videos from their device camera or gallery. It supports customization such as media type, resolution limits, image quality, and multiple file selection.
Properties
Select Media
Dropdown
No
The source for selecting media: "camera" or "gallery". Defaults to "gallery".
Camera Source
Dropdown
No
Camera to use when Select Media is "camera": "front" or "rear". Defaults to "rear".
Media Type
Dropdown
No
Type of media to select: "photo", "video", or "all". Defaults to allowing both.
Max Width
number
No
Maximum width for selected images in pixels.
Max Height
number
No
Maximum height for selected images in pixels.
Image Quality
number
No
Image quality (0-100). Higher values mean better quality but larger file sizes.
Max Duration
number
No
Maximum duration for selected videos in seconds.
File Variable
Dropdown
No
File Type Variable where the selected media file will be stored.
Use Cases
Profile Pictures: Allow users to upload or capture profile images
Photo Sharing: Enable users to select and share multiple photos
Document Scanning: Capture images of documents with quality controls
Video Messages: Record short video clips for messaging
Media Upload Forms: Attach images/videos to forms or posts
Default Behavior
By default:
Media Source
Opens gallery if no Select Media specified
Camera Device
Uses rear camera when capturing from camera
Media Type
Allows both photos and videos
Selection
Single file selection only
File Storage
Selected media stored in specified File Variable
User Cancellation
Action completes without error if user cancels
How to Use

Attach the action to a widget event (button tap, icon press, etc.)
Select Image Picker from the action list
Configure
Select Media(camera/gallery) andMedia Type(photo/video/all)Set optional constraints like for images
Max Width,Max Height,Image Qualityand for videosMax DurationSpecify
fileVariableto store the selected media
Implementation Details
The action uses the image_picker package to access device camera and gallery. Selected files are converted to AdaptedFile objects that include file data, metadata, and size information.
For web platforms, file bytes are read immediately. For mobile platforms, file size is determined from the file system.
When users cancel the picker (tap back or cancel), the action completes successfully without storing any files.
Related Actions
File Picker - Select documents or other file types
Upload - Upload selected files to a server
Set State - Update UI state with selected media
Last updated