Samy Gray
Samy Gray

Reputation: 43

.NET MAUI - crop camera image

Currently working on a feature where I want to crop an image taken from camera in iOS (Android already working)

Currently referred to the library
https://github.com/jbowmanp1107/ImageCropper.Maui
I have raised an issue
https://github.com/jbowmanp1107/ImageCropper.Maui/issues/7

Below Error Showing in file 'PlatformImageCropper.cs'
An error occurred: 'Could not create an native instance of the type 'Bind_TOCropViewController.TOCropViewController': the native class hasn't been loaded.

I have also tried implementing 'MediaPlugin' - Xamarin Library
https://github.com/jamesmontemagno/MediaPlugin
and i was able to run project in android but in iOS it crashes and feature is only available for iOS https://github.com/jamesmontemagno/MediaPlugin#allow-cropping

Can anyone please help on this feature would be great!!!

Upvotes: 0

Views: 1042

Answers (1)

Zack
Zack

Reputation: 1629

The image in Maui has a Clip property, you can set different shapes to it to achieve the effect you want to crop. For example:

//create circular area
var clip = new EllipseGeometry(new Point(100, 100), 100, 100);
// create a rectangular area
var clip1 = new RectangleGeometry(new Rect(100,100,100,100));
image. Clip = clip1;

Upvotes: 1

Related Questions