Plugin.Maui.ImageCropper
1.0.0
See the version list below for details.
dotnet add package Plugin.Maui.ImageCropper --version 1.0.0
NuGet\Install-Package Plugin.Maui.ImageCropper -Version 1.0.0
<PackageReference Include="Plugin.Maui.ImageCropper" Version="1.0.0" />
paket add Plugin.Maui.ImageCropper --version 1.0.0
#r "nuget: Plugin.Maui.ImageCropper, 1.0.0"
// Install Plugin.Maui.ImageCropper as a Cake Addin #addin nuget:?package=Plugin.Maui.ImageCropper&version=1.0.0 // Install Plugin.Maui.ImageCropper as a Cake Tool #tool nuget:?package=Plugin.Maui.ImageCropper&version=1.0.0
Xamarin.Plugin.Maui.ImageCropper
Simple crossplatform xamarin image cropper, you can use it in both Xamarin.Forms and Xamarin native. Also compatible with .NET 7
For mono use v1.0.1, for .NET use v1.1.1 https://www.nuget.org/packages/Xamarin.Plugin.Maui.ImageCropper
For Mono Android it uses
https://github.com/ArthurHub/Android-Image-Cropper for Android, supports Android 12
For .NET Android it uses
https://github.com/CanHub/Android-Image-Cropper for Android, supports Android 13
For iOS it uses
https://github.com/TimOliver/TOCropViewController for iOS
Initialize:
Android Mono:
It uses Plugin.CurrentActivity under the hood, so don't forget to initialize it in your MainActivity.cs's OnCreate method:
Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, bundle);
Also, you need to add OnActivityResult handler:
protected override void OnActivityResult(int requestCode, Result resultCode, Intent intent)
{
base.OnActivityResult(requestCode, resultCode, intent);
Plugin.Maui.ImageCropper.Platform.Droid.OnActivityResult(requestCode, resultCode, intent);
}
Don't forget to add this row into your AndroidManifest.xml file application tag:
<activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity" android:theme="@style/Base.Theme.AppCompat" />
iOS Mono:
No extra actions required
Android .NET:
All you need is to initialize it in your MainActivity.cs's OnCreate method:
Plugin.Maui.ImageCropper.Platform.Droid.Init(this);
Don't forget to add this row into your AndroidManifest.xml file application tag:
<activity android:name="com.canhub.cropper.CropImageActivity" android:theme="@style/Base.Theme.AppCompat" />
iOS .NET:
No extra actions required
Example of usage:
await ImageCropper.Current.Crop(new CropSettings()
{
AspectRatioX = 1,
AspectRatioY = 1,
CropShape = CropSettings.CropShapeType.Rectangle
}, imageFilePath).ContinueWith(t =>
{
if (t.IsFaulted)
{
var ex = t.Exception;
//alert user
}
else if (t.IsCanceled)
{
//do nothing
}
else if (t.IsCompletedSuccessfully)
{
var result = t.Result;
//do smth with result
}
});
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0-android31.0 is compatible. net6.0-ios16.1 is compatible. net7.0-android was computed. net7.0-android33.0 is compatible. net7.0-ios was computed. net7.0-ios16.1 is compatible. net8.0-android was computed. net8.0-ios was computed. net9.0-android was computed. net9.0-ios was computed. |
-
net6.0-android31.0
- Com.Vanniktech.AndroidImageCropper.Maui (>= 4.4.0)
-
net6.0-ios16.1
- System.Runtime.InteropServices.NFloat.Internal (>= 6.0.1)
- TimOliver.TOCropViewController.Maui (>= 2.3.6)
-
net7.0-android33.0
- Com.Vanniktech.AndroidImageCropper.Maui (>= 4.4.0)
-
net7.0-ios16.1
- TimOliver.TOCropViewController.Maui (>= 2.3.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.