Xamarin app that uses camera is saving photos as corrupt

Davi Moura 1 Reputation point
2022-06-03T17:32:14.857+00:00

I have this problem, I already changed the photos to all possible formats, but nothing has changed

CS:

namespace Aluno_Digital
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class CameraPage : ContentPage
    {
        public CameraPage()
        {
            InitializeComponent();
        }
        async void EscolherIMG(System.Object sender, System.EventArgs e)
        {
            var result = await MediaPicker.PickPhotoAsync(new MediaPickerOptions
            {
                Title = "Por favor uma imagem"
            });
            var stream = await result.OpenReadAsync();
            resultIMG.Source = ImageSource.FromStream(() => stream);
        }
        async void TirarFT(System.Object sender, System.EventArgs e)
        {
            var result = await MediaPicker.CapturePhotoAsync();
            var stream = await result.OpenReadAsync();
            var image = await result.OpenReadAsync();
            var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
            {
                Directory = "Fotos Tiradas",
                Name = "Foto.pdf"
            });
        }
    }
}
Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,299 questions
{count} votes