Blazorise Cropper API
Explore the Blazorise Cropper API reference for parameters, events, methods, and related types.
For examples and usage guidance, see the Cropper documentation.
API
Parameters
Cropper
| Parameter | Default | Type |
|---|---|---|
Alt | — | string |
Alternate text for the image. This parameter is retained for source compatibility. Use Text instead. | ||
CropperState | null | CropperState |
Provides the shared state and synchronization context between the cropper and cropper viewer. | ||
CrossOrigin | — | string |
The cross-origin attribute of the image. | ||
Enabled | true | bool |
Enables or disables cropper interactions. | ||
GridOptions | new CropperGridOptions() | CropperGridOptions |
Defines the grid overlay drawn inside the crop selection. | ||
ImageOptions | new CropperImageOptions() | CropperImageOptions |
Controls which image transform operations are available. | ||
SelectionOptions | new CropperSelectionOptions() | CropperSelectionOptions |
Defines the behavior and initial shape of the crop selection. | ||
ShowBackground | true | bool |
Shows the grid background behind the cropper. | ||
Source | — | string |
The source of the image. | ||
Text | — | string |
Alternate text for the image. | ||
CropperViewer
| Parameter | Default | Type |
|---|---|---|
CropperState | null | CropperState |
Provides the shared state and synchronization context between the cropper and cropper viewer. | ||
CropperCropOptions
| Parameter | Default | Type |
|---|---|---|
Height | 0 | int |
Output canvas height in pixels. | ||
ImageQuality | 1d | double? |
Compression quality for lossy formats, from 0 to 1.A user agent will use its default quality value if this option is not specified, or if the number is outside the allowed range. | ||
ImageType | image/png | string |
MIME type for the encoded cropped image. | ||
Width | 0 | int |
Output canvas width in pixels. | ||
CropperImageOptions
| Parameter | Default | Type |
|---|---|---|
Rotatable | true | bool |
Rotation commands can change the image angle. | ||
Scalable | true | bool |
Scale commands can resize the image on the X or Y axis. | ||
Skewable | false | bool |
Skew commands can slant the image horizontally or vertically. | ||
Translatable | true | bool |
Move commands can reposition the image within the cropper. | ||
CropperSelectionOptions
| Parameter | Default | Type |
|---|---|---|
AspectRatio | CropperAspectRatio.Is1x1 | CropperAspectRatio |
Fixed ratio maintained while resizing the selection. | ||
InitialAspectRatio | CropperAspectRatio.Is1x1 | CropperAspectRatio |
Ratio used for the selection created during initialization. | ||
InitialCoverage | null | double? |
Fraction of the image covered by the initial selection, from 0 to 1. | ||
Keyboard | true | bool |
Keyboard input can move or resize the active selection. | ||
Movable | true | bool |
The selection can be dragged to a new position. | ||
Outlined | true | bool |
The selection renders with a visible outline. | ||
Resizable | true | bool |
Selection edges and handles can change its size. | ||
Zoomable | true | bool |
Mouse wheel or gesture zoom can be applied from the selection. | ||
CropperGridOptions
| Parameter | Default | Type |
|---|---|---|
Bordered | true | bool |
The grid renders border lines around its cells. | ||
Columns | 3 | int |
Number of vertical grid divisions. | ||
Covered | true | bool |
The grid fills the full selection area. | ||
Rows | 3 | int |
Number of horizontal grid divisions. | ||
Events
Cropper
| Event | Type |
|---|---|
CropEnded | Func<Task> |
This event fires when the canvas (image wrapper) or the crop box stops changing. | |
CropMoved | Func<Task> |
This event fires when the canvas (image wrapper) or the crop box is changing. | |
Cropped | Func<CropperCroppedEventArgs, Task> |
This event fires when the canvas (image wrapper) or the crop box changes. | |
CropStarted | Func<Task> |
This event fires when the canvas (image wrapper) or the crop box starts to change. | |
ImageLoadingFailed | Func<string, Task> |
This event fires when the image cannot be loaded. Usually because of 404 or Source being null. Returns an error message as a parameter. | |
ImageReady | Func<Task> |
This event fires when the image is ready / loaded. | |
SelectionChanged | Func<CropperSelectionChangedEventArgs, Task> |
The event is fired when the position or size of the selection is going to change. | |
Zoomed | Func<CropperZoomedEventArgs, Task> |
This event fires when a cropper instance starts to zoom in or zoom out its canvas (image wrapper). | |
Methods
Cropper
| Method | Return | Parameters |
|---|---|---|
Center | ValueTask | string size |
Center the image.
| ||
CropAsBase64ImageAsync | ValueTask<string> | CropperCropOptions options |
Get the cropped image as Base64 image.
| ||
MoveTo | ValueTask | int x, int y |
Moves the image to a specific position.
| ||
Move | ValueTask | int x, int y |
Moves the image.
| ||
ResetSelection | ValueTask | — |
Resets the selection to its initial position and size.
| ||
Rotate | ValueTask | double angle |
Rotates the image.
| ||
Scale | ValueTask | int x, int y |
Scale the image.
| ||
Zoom | ValueTask | double scale |
Zooms the image.
| ||