![]() |
VOOZH | about |
dotnet add package Cropper.Blazor --version 1.5.1
NuGet\Install-Package Cropper.Blazor -Version 1.5.1
<PackageReference Include="Cropper.Blazor" Version="1.5.1" />
<PackageVersion Include="Cropper.Blazor" Version="1.5.1" />Directory.Packages.props
<PackageReference Include="Cropper.Blazor" />Project file
paket add Cropper.Blazor --version 1.5.1
#r "nuget: Cropper.Blazor, 1.5.1"
#:package Cropper.Blazor@1.5.1
#addin nuget:?package=Cropper.Blazor&version=1.5.1Install as a Cake Addin
#tool nuget:?package=Cropper.Blazor&version=1.5.1Install as a Cake Tool
👁 Deploy to NuGet
👁 Deploy to GitHub Pages
👁 coverage
👁 GitHub
👁 GitHub
👁 NuGet Downloads
👁 NuGet Version
The most powerful image cropping tool for Blazor Web App / WebAssembly / Server, Hybrid with MAUI, MVC and other frameworks.
Cropper.Blazor is an essential component for building interactive image cropping and manipulation features in Blazor web applications. This versatile Blazor library empowers developers to integrate intuitive image cropping functionality directly into their Blazor projects, offering users a seamless and responsive image editing experience.
| Cropper.Blazor | .NET | Support |
|---|---|---|
| - | .NET 3.1, .NET 5 | Not supported |
| 1.1.x | .NET 6 | ✔️ |
| 1.2.x | .NET 6, .NET 7 | ✔️ |
| 1.3.x | .NET 6, .NET 7, .NET 8 | ✔️ |
| 1.4.x | .NET 6, .NET 7, .NET 8, .NET 9 | ✔️ |
| 1.5.x | .NET 6, .NET 7, .NET 8, .NET 9, .NET 10 | ✔️ |
Supported .NET 10.0, .NET 9.0, .NET 8.0, .NET 7.0, .NET 6.0 versions for these web platforms:
Note: if you have problem with MAUI project dependencies:
dotnet workload update + rebuilt the project. If that doesn't help, try the step below about override package<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" VersionOverride="7.0.1" />Cropper.Blazor streamlines the implementation of image cropping and editing within Blazor applications, enhancing user engagement and enabling dynamic image manipulation. Whether you are developing a Blazor-based image editor, profile picture uploader, or any other application that requires image cropping, Cropper.Blazor is a valuable package that simplifies the development process and enriches your application's capabilities.
dotnet add package Cropper.Blazor
Import Custom Element:
@using Cropper.Blazor.Components
Add the following to index.html (client-side — Blazor Webassembly, Blazor MAUI) or _Host.cshtml (server-side — Blazor Server, MVC with Blazor Server) in the head
<link href="_content/Cropper.Blazor/cropper.min.css" rel="stylesheet" />
Add the following to index.html or _Host.cshtml in the body
<script src="_content/Cropper.Blazor/cropper.min.js"></script>
Add the following to the relevant sections of Program.cs
using Cropper.Blazor.Extensions;
builder.Services.AddCropper();
In addition, you can change the path to the cropperJSInterop.min.js module if for some reason it is located outside the server root folder as follows:
builder.Services.AddCropper(new CropperJsInteropOptions()
{
DefaultInternalPathToCropperModule = "<YourPath>/_content/Cropper.Blazor/cropperJsInterop.min.js"
})
builder.Services.AddCropper(new CropperJsInteropOptions()
{
IsActiveGlobalPath = true,
GlobalPathToCropperModule = "<StartUrlWithPath>/_content/Cropper.Blazor/cropperJsInterop.min.js"
})
Also for server-side (Blazor Server or MVC with Blazor Server) you need add configuration SignalR, increase MaximumReceiveMessageSize of a single incoming hub message (default is 32KB) and map SignalR to your path. However, if your images are too large, the MaximumReceiveMessageSize variable should be increased to the desired value. For example:
builder.Services.AddServerSideBlazor()
.AddHubOptions(options =>
{
options.MaximumReceiveMessageSize = 32 * 1024 * 100;
});
app.MapBlazorHub();
And then use it in Razor file (for example):
<CropperComponent
Class="cropper-container"
ErrorLoadImageClass="cropper-error-load"
@ref="CropperComponent"
OnCropStartEvent="OnCropStartEvent"
OnCropEndEvent="OnCropEndEvent"
OnCropEvent="OnCropEvent"
OnZoomEvent="OnZoomEvent"
OnCropMoveEvent="OnCropMoveEvent"
OnReadyEvent="OnCropReadyEvent"
OnLoadImageEvent="OnLoadImageEvent"
Src="@Src"
InputAttributes="@InputAttributes"
ErrorLoadImageSrc="@_errorLoadImageSrc"
IsErrorLoadImage="@IsErrorLoadImage"
OnErrorLoadImageEvent="OnErrorLoadImageEvent"
Options="Options"
IsAvailableInitCropper="IsAvailableInitCropper">
</CropperComponent>
And then use it in *.razor.cs file
You may override Cropper JavaScript module with execution script which can replace 6 event handlers (onReady, onCropStart, onCropMove, onCropEnd, onCrop, onZoom), such as overriding the onZoom callback in JavaScript:
window.overrideOnZoomCropperEvent = (minZoomRatio, maxZoomRatio) => {
window.cropper.onZoom = function (imageObject, event, correlationId) {
const jSEventData = this.getJSEventData(event, correlationId);
const isApplyPreventZoomMinRatio = (minZoomRatio != null) && (minZoomRatio > event.detail.ratio);
const isApplyPreventZoomMaxRatio = (maxZoomRatio != null) && (event.detail.ratio > maxZoomRatio);
if (isApplyPreventZoomMinRatio || isApplyPreventZoomMaxRatio) {
event.preventDefault();
}
else {
imageObject.invokeMethodAsync('CropperIsZoomed', jSEventData);
}
};
};
Analysis of the signature onReady, onCropStart, onCropMove, onCropEnd, onCrop, onZoom event handlers:
ObjectReference to base cropper component.
CustomEventRepresent Cropper Event.
StringCropper.BlazorA Correlation ID is a unique identifier that is added to the very first interaction(incoming request) to identify the context and is passed to all components that are involved in the transaction flow.
Definitely need to tell these rules in Blazor:
await JSRuntime!.InvokeVoidAsync("window.overrideCropperJsInteropModule", MinZoomRatio, MaxZoomRatio);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 3 NuGet packages that depend on Cropper.Blazor:
| Package | Downloads |
|---|---|
|
Jarvis.Blazor.Mud
Biblioteca de componentes para MudBlazor. |
|
|
Jakar.Extensions.Blazor
Extensions to aid in development. |
|
|
AlphaX.Blazor.Components.ImageCropper
This Blazor-based package integrates Radzen components with the powerful image cropping functionalities of CropperBlazor and Cropper.js. It offers a seamless and intuitive image cropping experience for Blazor applications, providing developers with ready-to-use components to implement and customize image editing features in their web applications. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.5.1 | 33,567 | 2/3/2026 |
| 1.5.0 | 16,242 | 11/26/2025 |
| 1.4.3 | 20,348 | 10/18/2025 |
| 1.4.2 | 42,500 | 6/6/2025 |
| 1.4.1 | 6,103 | 5/21/2025 |
| 1.4.0 | 15,700 | 3/12/2025 |
| 1.3.4 | 58,601 | 8/4/2024 |
| 1.3.2 | 33,552 | 3/30/2024 |
| 1.3.1 | 14,474 | 2/2/2024 |
| 1.3.0 | 6,759 | 11/18/2023 |
| 1.2.7 | 4,256 | 11/9/2023 |
| 1.2.6 | 4,365 | 10/8/2023 |
| 1.2.5 | 1,335 | 9/12/2023 |
| 1.2.4 | 1,076 | 7/24/2023 |
| 1.2.3 | 1,103 | 7/15/2023 |
| 1.2.2 | 735 | 6/23/2023 |
| 1.2.1 | 380 | 6/22/2023 |
| 1.2.0 | 4,596 | 5/1/2023 |
| 1.1.4 | 1,996 | 4/1/2023 |