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

ParameterDefaultType
Alt—string

Alternate text for the image.
This parameter is retained for source compatibility. Use Text instead.
CropperStatenullCropperState

Provides the shared state and synchronization context between the cropper and cropper viewer.
CrossOrigin—string

The cross-origin attribute of the image.
Enabledtruebool

Enables or disables cropper interactions.
GridOptionsnew CropperGridOptions()CropperGridOptions

Defines the grid overlay drawn inside the crop selection.
ImageOptionsnew CropperImageOptions()CropperImageOptions

Controls which image transform operations are available.
SelectionOptionsnew CropperSelectionOptions()CropperSelectionOptions

Defines the behavior and initial shape of the crop selection.
ShowBackgroundtruebool

Shows the grid background behind the cropper.
Source—string

The source of the image.
Text—string

Alternate text for the image.

CropperViewer

ParameterDefaultType
CropperStatenullCropperState

Provides the shared state and synchronization context between the cropper and cropper viewer.

CropperCropOptions

ParameterDefaultType
Height0int

Output canvas height in pixels.
ImageQuality1ddouble?

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.
ImageTypeimage/pngstring

MIME type for the encoded cropped image.
Width0int

Output canvas width in pixels.

CropperImageOptions

ParameterDefaultType
Rotatabletruebool

Rotation commands can change the image angle.
Scalabletruebool

Scale commands can resize the image on the X or Y axis.
Skewablefalsebool

Skew commands can slant the image horizontally or vertically.
Translatabletruebool

Move commands can reposition the image within the cropper.

CropperSelectionOptions

ParameterDefaultType
AspectRatioCropperAspectRatio.Is1x1CropperAspectRatio

Fixed ratio maintained while resizing the selection.
InitialAspectRatioCropperAspectRatio.Is1x1CropperAspectRatio

Ratio used for the selection created during initialization.
InitialCoveragenulldouble?

Fraction of the image covered by the initial selection, from 0 to 1.
Keyboardtruebool

Keyboard input can move or resize the active selection.
Movabletruebool

The selection can be dragged to a new position.
Outlinedtruebool

The selection renders with a visible outline.
Resizabletruebool

Selection edges and handles can change its size.
Zoomabletruebool

Mouse wheel or gesture zoom can be applied from the selection.

CropperGridOptions

ParameterDefaultType
Borderedtruebool

The grid renders border lines around its cells.
Columns3int

Number of vertical grid divisions.
Coveredtruebool

The grid fills the full selection area.
Rows3int

Number of horizontal grid divisions.

Events

Cropper

EventType
CropEndedFunc<Task>

This event fires when the canvas (image wrapper) or the crop box stops changing.
CropMovedFunc<Task>

This event fires when the canvas (image wrapper) or the crop box is changing.
CroppedFunc<CropperCroppedEventArgs, Task>

This event fires when the canvas (image wrapper) or the crop box changes.
CropStartedFunc<Task>

This event fires when the canvas (image wrapper) or the crop box starts to change.
ImageLoadingFailedFunc<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.
ImageReadyFunc<Task>

This event fires when the image is ready / loaded.
SelectionChangedFunc<CropperSelectionChangedEventArgs, Task>

The event is fired when the position or size of the selection is going to change.
ZoomedFunc<CropperZoomedEventArgs, Task>

This event fires when a cropper instance starts to zoom in or zoom out its canvas (image wrapper).

Methods

Cropper

MethodReturnParameters
CenterValueTaskstring size

Center the image.
CropAsBase64ImageAsyncValueTask<string>CropperCropOptions options

Get the cropped image as Base64 image.
MoveToValueTaskint x, int y

Moves the image to a specific position.
MoveValueTaskint x, int y

Moves the image.
ResetSelectionValueTask—

Resets the selection to its initial position and size.
RotateValueTaskdouble angle

Rotates the image.
ScaleValueTaskint x, int y

Scale the image.
ZoomValueTaskdouble scale

Zooms the image.
On this page