MediaFile result = await mediaPicker.TakePhotoAsync (
new CameraMediaStorageOptions {
DefaultCamera = CameraDevice.Rear,
});
Image CaptureImage = new Image {
HeightRequest = 35,
WidthRequest = 35,
Aspect = Aspect.Fill,
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.StartAndExpand,
Source = ImageSource.FromFile (result.Path)
};
I'm using above code to allow user to select file and show the selected image on page. But camera images are too large.
And here i want to compress the image and then show on page.
In addition, i'm using following code to send the selected file's base64 string on server,
MemoryStream ms = new MemoryStream ();
MyFile.Source.CopyTo(ms);
byte[] b = ms.ToArray();
String s = Convert.ToBase64String(b);
So also want a way to compress it aswell.