The Image is too big. which is over 3mb
can the Image show only 100 * 100 pixel of it?
The Image is too big. which is over 3mb
can the Image show only 100 * 100 pixel of it?
Hello,
Welcome to our Microsoft Q&A platform!
Xamarin.Forms.Image doesn't provide the 'thumb' property. To compress the image's size, try to achieve the function on each platform.
For example, here is the related the code about resizing images on Android.
public static byte[] ResizeImageAndroid(byte[] imageData, float width, float height)
{
// Load the bitmap
Bitmap originalImage = BitmapFactory.DecodeByteArray(imageData, 0, imageData.Length);
Bitmap resizedImage = Bitmap.CreateScaledBitmap(originalImage, (int)width, (int)height, false);
using (MemoryStream ms = new MemoryStream())
{
resizedImage.Compress(Bitmap.CompressFormat.Jpeg, 100, ms);
return ms.ToArray();
}
}
Official sample code:
https://github.com/xamarin/xamarin-forms-samples/blob/main/XamFormsImageResize/XamFormsImageResize/ImageResizer.cs
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
7 people are following this question.