ImageCropper.Maui 1.2.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package ImageCropper.Maui --version 1.2.2                
NuGet\Install-Package ImageCropper.Maui -Version 1.2.2                
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="ImageCropper.Maui" Version="1.2.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ImageCropper.Maui --version 1.2.2                
#r "nuget: ImageCropper.Maui, 1.2.2"                
#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 ImageCropper.Maui as a Cake Addin
#addin nuget:?package=ImageCropper.Maui&version=1.2.2

// Install ImageCropper.Maui as a Cake Tool
#tool nuget:?package=ImageCropper.Maui&version=1.2.2                

ImageCropper.Maui

.NET MAUI plugin to crop and rotate photos.

Ported over and updated from from : https://github.com/stormlion227/ImageCropper.Forms

NuGet

Supports Android and iOS.

Features

  • Cropping image.
  • Rotating image.
  • Aspect ratio.
  • Circle/Rectangle shape.

Screen-Shots

Android

<img src="ScreenShots/Android_Rectangle.gif" alt="Crop/Rotate image(Rectangle/Android)"/> <img src="ScreenShots/Android_Circle.gif" alt="Crop/Rotate image(Circle/Android)"/>

iOS

<img src="ScreenShots/iOS_Rectangle.gif" alt="Crop/Rotate image(Rectangle/iOS)"/> <img src="ScreenShots/iOS_Circle.gif" alt="Crop/Rotate image(Circle/iOS)" />

Setup

  • Install the nuget package in portable and all platform specific projects. NOTE: TOCropView.Maui results in long file paths, and if your base repo path is little long, this package cannot be succesfully installed from Visual Studio. To work around this issue install the package using 'dotnet restore' from the CLI.

  • This plugin uses the MediaPicker, so be sure to complete the full setup this. Please fully read through the MediaPicker description.

Android

Add the following to your AndroidManifest.xml inside the <application> tags:

	<activity android:name="com.canhub.cropper.CropImageActivity"
	          android:theme="@style/Base.Theme.AppCompat"/>	

In MainActivity.cs file:

    public class MainActivity : MauiAppCompatActivity
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            new ImageCropper.Maui.Platform().Init(this);
            base.OnCreate(savedInstanceState);
        }
    }


### iOS

In AppDelegate.cs file:

```cs
     new ImageCropper.Maui.Platform().Init(this);

Usage

Show ImageCropper page.

    new ImageCropper()
    {
        Success = (imageFile) =>
        {
            Dispatcher.Dispatch(() =>
            {
                imageView.Source = ImageSource.FromFile(imageFile);
            });
        }
    }.Show(this);

Show it with additional parameters.

    new ImageCropper()
    {
        PageTitle = "Test Title",
        AspectRatioX = 1,
        AspectRatioY = 1,
	CropShape = ImageCropper.CropShapeType.Oval,
	SelectSourceTitle = "Select source",
	TakePhotoTitle = "Take Photo",
	PhotoLibraryTitle = "Photo Library",
	CancelButtonTitle = "Cancel",
        Success = (imageFile) =>
        {
            Dispatcher.Dispatch(() =>
            {
                imageView.Source = ImageSource.FromFile(imageFile);
            });
        }
    }.Show(this);

Show it with a image

    new ImageCropper()
    {
        Success = (imageFile) =>
        {
            Dispatcher.Dispatch(() =>
            {
                imageView.Source = ImageSource.FromFile(imageFile);
            });
        }
    }.Show(this, imageFileName);

Properties

  • PageTitle
  • AspectRatioX
  • AspectRatioY
  • CropShape
  • Initial image can be set in Show function.

Contributions

Contributions are welcome!

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.3 1,417 9/17/2024
1.2.2 116 9/17/2024
1.2.1 741 9/12/2024
1.2.0 1,431 8/3/2024
1.1.0.7 14,856 3/29/2024
1.1.0.6 122 3/29/2024
1.1.0.5 220 3/27/2024
1.1.0.4 131 3/27/2024
1.1.0.2 193 3/23/2024
1.1.0.1 153 3/23/2024
1.0.3 16,272 1/25/2023
1.0.2 509 12/20/2022
1.0.1 345 12/19/2022
1.0.0 414 11/1/2022
1.0.0-alpha 152 10/31/2022