-1

I want to crop an image in xamarin forms with an interface that the user can crop mannualy the image taken from Xamarin.Essentials Media Picker. I´m using the MVVM pattern. I tried to use SkiaSharp, but not work properly.

Any ideas?

Thanks For helping.

Matheus
  • 69
  • 5

1 Answers1

0

Please Check this nuget Xamarin.Controls.ImageCropper.

Example Code:

  Source = mediaFile.Path; // Local Path of the image
  await ImageCropper.Current.Crop(new CropSettings()
                    {
                        AspectRatioX = 0,
                        AspectRatioY = 0,
                        CropShape = CropSettings.CropShapeType.Rectangle
                    }, Source).ContinueWith(t =>
                    {
                        if (t.IsFaulted)
                        {
                            var ex = t.Exception;
                            //alert user
                        }
                        else if (t.IsCanceled)
                        {
                            //do nothing
                        }
                        else if (t.IsCompleted)
                        {
                            LocalMediaPath = t.Result;
                            //do smth with result
                        }
                    });
Amjad S.
  • 1,196
  • 1
  • 4
  • 16