Back to results for “Device Features”
.NET MAUI › Device Features & Essentials

How do you pick or capture a photo in MAUI?

Beginner

Answer

Use MediaPicker.Default.PickPhotoAsync to choose from the gallery or CapturePhotoAsync to use the camera (camera requires permission and hardware). Both return a FileResult you can open as a stream to display or upload.
var photo = await MediaPicker.Default.CapturePhotoAsync();
if (photo is not null)
{
    using var stream = await photo.OpenReadAsync();
    // save or display
}
Real-world example A profile screen lets users take a new avatar photo or pick an existing one with a couple of lines.

Common follow-ups: Does capture need permission? | What does PickPhotoAsync return?