Forum Xamarin.Forms

why after loading an image from the gallery the device is slow?

lucapasquinilucapasquini USMember ✭✭
edited March 2017 in Xamarin.Forms

this is my method:
button2 is a button object and image1 is a image object.

button2.Clicked += async (sender, args) =>
if (!CrossMedia.Current.IsPickPhotoSupported)

                await DisplayAlert("no upload", "picking a photo is not supported", "ok");

            MediaFile file = await CrossMedia.Current.PickPhotoAsync();

            if (file == null)

            Image1.Source = ImageSource.FromStream(() => file.GetStream());

Best Answer


  • MCvelMCvel USMember ✭✭✭
    Accepted Answer

    that sounds weird, unless the image is too big,

    if that is the case, I recommend to use FFImageLoading - you can use downsampling to reduce the image size or memory usage


  • lucapasquinilucapasquini USMember ✭✭

    Thanks, it worked. I made this change:

    var Image1 = new CachedImage
    Source = "noimagebox.png",
    HeightRequest = 200,
    DownsampleToViewSize = true,

Sign In or Register to comment.