Reputation: 27
I created a project in Xamarin form and I want to select a photo from the gallery in a part of it and display it in a image tag.
first i add Plugin.Media from nuget.
my code is :
var file = await CrossMedia.Current.PickPhotoAsync(mediaOption);
img.Source = file.Path;
but my problem is when picture selected and showed, picture is very small!
I use :
var mediaOption = new PickMediaOptions()
{
PhotoSize = PhotoSize.Large,
CompressionQuality = 100,
CustomPhotoSize = 100
};
but that no work!
How i can Avoid resizing image?
Upvotes: 0
Views: 282
Reputation: 10978
Resizing photo size can be accomplished by adjusting the PhotoSize property on the options.
The easiest is to adjust it to Small, Medium, or Large, which is 25%, 50%, or 75% or the original.
var mediaOption = new PickMediaOptions()
{
PhotoSize = PhotoSize.Large,//Resize to 75% of original
CompressionQuality = 100,
};
If you want to set to a custom percentage, you could use the Custom
for the PhotoSize
property. The 100 value in your code is not used for the 100px.
var mediaOption = new PickMediaOptions()
{
PhotoSize = PhotoSize.Custom,
CustomPhotoSize = 100, //Resize to 100% of original
CompressionQuality = 100,
};
Upvotes: 1