Xamarin.Controls.ImageCropper 1.2.4

dotnet add package Xamarin.Controls.ImageCropper --version 1.2.4                
NuGet\Install-Package Xamarin.Controls.ImageCropper -Version 1.2.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Xamarin.Controls.ImageCropper" Version="1.2.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Xamarin.Controls.ImageCropper --version 1.2.4                
#r "nuget: Xamarin.Controls.ImageCropper, 1.2.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Xamarin.Controls.ImageCropper as a Cake Addin
#addin nuget:?package=Xamarin.Controls.ImageCropper&version=1.2.4

// Install Xamarin.Controls.ImageCropper as a Cake Tool
#tool nuget:?package=Xamarin.Controls.ImageCropper&version=1.2.4                

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 Nuget ✖️ ✖️
Xamarin Nuget ✖️ ✖️
.NET Nuget ✖️ ✖️

Powered By:

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 Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-android34.0 is compatible.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-ios17.5 is compatible.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.4 411 9/4/2024
1.2.3.1 594 4/19/2024
1.2.3 141 3/29/2024
1.2.2 122 3/28/2024
1.2.1 111 3/25/2024
1.2.0 1,160 11/15/2023
1.1.2 419 9/6/2023
1.1.1 454 1/17/2023
1.0.1 24,254 2/25/2021