ImageCropper.Maui 1.2.3

dotnet add package ImageCropper.Maui --version 1.2.3                
NuGet\Install-Package ImageCropper.Maui -Version 1.2.3                
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.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ImageCropper.Maui --version 1.2.3                
#r "nuget: ImageCropper.Maui, 1.2.3"                
#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.3

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

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,176 9/17/2024
1.2.2 115 9/17/2024
1.2.1 712 9/12/2024
1.2.0 1,387 8/3/2024
1.1.0.7 14,690 3/29/2024
1.1.0.6 122 3/29/2024
1.1.0.5 218 3/27/2024
1.1.0.4 131 3/27/2024
1.1.0.2 193 3/23/2024
1.1.0.1 151 3/23/2024
1.0.3 16,218 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