I need some help related to image sizing in Xamarin Farms Cross PlatForm.
I have taken the picture from my mobile using the Plugin.Media. Its generate the image in my mobile with the size of 1.42 MB and Resolution 2160x2160. I need to upload this image using Rest API. First thing is this is it possible that this size decrease to kbs?
Second thing is this i use the Xamarin.Plugin.ImageEditer to change the image size to 768x1024. It change the image size but the size is still in 1MB. The code is as following.
private async Task<byte[]> ResizeImage(string ImagePath)
{
FileStream fs = new FileStream(ImagePath, FileMode.Open, FileAccess.Read);
using (var image = await CrossImageEdit.Current.CreateImageAsync(fs))
{
var imgReSiz = await Task.Run(() =>
image.Resize(768, 1024)
.ToPng()
);
return imgReSiz;
}
}
What i can do to set the image size not more then 100kb?