Xamarin.Controls.ImageCropper
1.5.0
dotnet add package Xamarin.Controls.ImageCropper --version 1.5.0
NuGet\Install-Package Xamarin.Controls.ImageCropper -Version 1.5.0
<PackageReference Include="Xamarin.Controls.ImageCropper" Version="1.5.0" />
<PackageVersion Include="Xamarin.Controls.ImageCropper" Version="1.5.0" />
<PackageReference Include="Xamarin.Controls.ImageCropper" />
paket add Xamarin.Controls.ImageCropper --version 1.5.0
#r "nuget: Xamarin.Controls.ImageCropper, 1.5.0"
#:package Xamarin.Controls.ImageCropper@1.5.0
#addin nuget:?package=Xamarin.Controls.ImageCropper&version=1.5.0
#tool nuget:?package=Xamarin.Controls.ImageCropper&version=1.5.0
MAUI / Xamarin ImageCropper
Simple crossplatform MAUI / Xamarin image cropper, you can use it in Xamarin.Forms, Xamarin native and MAUI.
| Supported platforms | Nuget | Android | iOS | Windows | MacCatalyst |
|---|---|---|---|---|---|
| MAUI | ✅ | ✅ | ✖️ | ✖️ | |
| Xamarin | ✅ | ✅ | ✖️ | ✖️ | |
| .NET | ✅ | ✅ | ✖️ | ✖️ |
Powered By:
- Mono Android - uses ArturHub's Android-Image-Cropper
- .NET / MAUI Android - uses CanHub's Android-Image-Cropper
- iOS - uses uses Tim Oliver's TOCropViewController
Another platforms:
Currently Windows and MacCatalyst are not supported, but your PRs are welcome
Mono setup:
Android:
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:
No extra actions required
.NET setup:
Android:
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:
No extra actions required
MAUI setup:
To use it in MAUI you should call UseImageCropper() method from Plugin.Maui.ImageCropper namespace on your MauiAppBuilder.
Also there is another overload which allows you to register ImageCropper instance in services and then use it with DI
UseImageCropper(registerInterface: true)
Android:
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:
No extra actions required
Example of usage:
Note: in MAUI use Cropper class instead of ImageCropper
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 | net9.0 is compatible. net9.0-android was computed. net9.0-android35.0 is compatible. net9.0-browser was computed. net9.0-ios was computed. net9.0-ios18.0 is compatible. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-android36.0 is compatible. net10.0-browser was computed. net10.0-ios was computed. net10.0-ios26.0 is compatible. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
-
net10.0-android36.0
- Com.Vanniktech.AndroidImageCropper.Maui (>= 4.6.0)
-
net10.0-ios26.0
- TOCropView.Maui (>= 2.6.1.9)
-
net9.0
- No dependencies.
-
net9.0-android35.0
- Com.Vanniktech.AndroidImageCropper.Maui (>= 4.6.0)
-
net9.0-ios18.0
- TOCropView.Maui (>= 2.6.1.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.