New to Telerik UI for Blazor? Start a free 30-day trial

Blazor ImageEditor Commands

Updated on Nov 9, 2026

The ImageEditor exposes an ExecuteAsync method that applies an edit from the application code. The method runs the same commands that the built-in tools run, and adds the result to the undo history.

Use ExecuteAsync to:

  • Apply presets.
  • Build a custom toolbar outside the component.
  • Repeat an edit across several images.

Execute a Command

The ExecuteAsync method has two overloads:

MethodDescription
ExecuteAsync(ImageEditorCommand command, ImageEditorCommandArgs args)Runs a command that requires arguments. The method throws an ArgumentException when the arguments class does not match the command.
ExecuteAsync(ImageEditorCommand command)Runs a command that does not require arguments, for example, ResetCrop.

To call the method, obtain a reference to the component instance with the @ref directive attribute.

Apply a filter programmatically

RAZOR
<TelerikButton OnClick="@OnSepiaButtonClick">Apply Sepia</TelerikButton>

<TelerikImageEditor @ref="@ImageEditorRef" ImageUrl="images/sample-photo.jpg" />

@code {
    private TelerikImageEditor ImageEditorRef { get; set; }

    private async Task OnSepiaButtonClick()
    {
        await ImageEditorRef.ExecuteAsync(ImageEditorCommand.ApplyFilter,
            new ImageEditorFilterArgs() { Filter = ImageEditorFilter.Sepia });
    }
}

Command Reference

All commands are members of the ImageEditorCommand enum. Each command uses one arguments class that inherits the abstract ImageEditorCommandArgs class. The OnExecute event reports the same commands and arguments when the user edits the image through the UI.

The X, Y, Width, and Height values in ImageEditorRect and the X and Y values in ImageEditorPoint are relative to the image and range from 0 to 1.

To use absolute pixel coordinates in a command, divide them by the image dimensions.

Use pixel coordinates in ImageEditor commands

RAZOR
@code {
    private const double ImageWidth = 1920;
    private const double ImageHeight = 1080;
    private TelerikImageEditor ImageEditorRef { get; set; }

    private static ImageEditorRect Rect(double x, double y, double width, double height)
    {
        return new ImageEditorRect()
        {
            X = x / ImageWidth,
            Y = y / ImageHeight,
            Width = width / ImageWidth,
            Height = height / ImageHeight
        };
    }

    private static ImageEditorPoint Point(double x, double y)
    {
        return new ImageEditorPoint()
        {
            X = x / ImageWidth,
            Y = y / ImageHeight
        };
    }

    private async Task AddAnnotations()
    {
        await ImageEditorRef.ExecuteAsync(ImageEditorCommand.AddText,
            new ImageEditorTextArgs()
            {
                Text = "Damage Claim",
                Area = Rect(1560, 60, 360, 50),
                Rotation = 30
            });

        await ImageEditorRef.ExecuteAsync(ImageEditorCommand.AddShape,
            new ImageEditorShapeArgs()
            {
                Shape = ImageEditorShapeType.Line,
                From = Point(480, 250),
                To = Point(320, 150)
            });
    }
}

Crop and Resize Commands

CommandArguments ClassArguments Properties
CropImageEditorCropArgsArea
CropToAspectRatioImageEditorCropToAspectRatioArgsAspectRatio (null for the original ratio), Orientation, Area
SetCropSizeImageEditorSizeArgsWidth, Height, LockAspectRatio
ResizeImageEditorSizeArgsWidth, Height, Unit, LockAspectRatio
ResetCropNoneNot applicable
ResetSizeNoneNot applicable

Transform Commands

CommandArguments ClassArguments Properties
RotateImageEditorAngleArgsAngle
SetRotationImageEditorAngleArgsAngle
StraightenImageEditorAngleArgsAngle
SetTransformImageEditorTransformArgsRotation, Straighten, FlipHorizontal, FlipVertical
FlipImageEditorFlipArgsDirection
ScaleImageEditorScaleArgsFactor
ResetTransformNoneNot applicable

Color Commands

CommandArguments ClassArguments Properties
ApplyFilterImageEditorFilterArgsFilter
AdjustImageEditorAdjustArgsAdjustment, Value
AdjustManyImageEditorAdjustmentsArgsBrightness, Exposure, Contrast, Saturation, Hue, Blur, Opacity
ResetAdjustmentsNoneNot applicable
ResetColorNoneNot applicable

Blur Commands

CommandArguments ClassArguments Properties
AddBlurImageEditorBlurArgsId, Area, Mode, Shape, Intensity
AddBlursImageEditorBlursArgsBlurs
UpdateBlurImageEditorBlurArgsId, Area, Mode, Shape, Intensity
DeleteBlurImageEditorObjectArgsId
ClearBlursNoneNot applicable

Object Commands

The following commands manage the text boxes and shapes on the canvas. See also Objects.

CommandArguments ClassArguments Properties
AddShapeImageEditorShapeArgsId, Shape, Area, From, To, Stroke, Fill, LineStart, LineEnd, Rotation
AddTextImageEditorTextArgsId, Text, Area, Style, Rotation
UpdateObjectImageEditorUpdateObjectArgsId, plus any property to change
AlignObjectImageEditorAlignObjectArgsId, Horizontal, Vertical, Target
MoveObjectImageEditorMoveObjectArgsId, DeltaX, DeltaY
ReorderObjectImageEditorReorderObjectArgsId, Index
DuplicateObjectImageEditorObjectArgsId
FlipObjectImageEditorObjectArgsId
DeleteObjectImageEditorObjectArgsId
ClearObjectsNoneNot applicable

Frame and Shadow Commands

CommandArguments ClassArguments Properties
SetFrameImageEditorFrameArgsType, Count, Thickness, Roundness, Offset, Position, StrokeType, Color, ImageCornerRadius
SetFrameSideImageEditorFrameArgsType, Count, Thickness, Roundness, Offset, Position, StrokeType, Color, ImageCornerRadius
SetCornerRadiusImageEditorCornerRadiusArgsRadius
SetShadowImageEditorShadowArgsEnabled, OffsetX, OffsetY, Blur, Spread, Color, Opacity
RemoveFrameNoneNot applicable
RemoveShadowNoneNot applicable

Export Commands

The following commands configure the export settings.

CommandArguments ClassArguments Properties
SetExportFormatImageEditorExportSettingsArgsFormat
SetExportQualityImageEditorExportSettingsArgsQuality
SetFileNameImageEditorExportSettingsArgsFileName
SetExportSettingsImageEditorExportSettingsArgsFormat, Quality, FileName

Shared Types

The command arguments classes use the following types:

TypeProperties
ImageEditorRectX, Y, Width, Height
ImageEditorPointX, Y
ImageEditorStrokeColor, Width, Opacity, StrokeType
ImageEditorFillColor, Opacity
ImageEditorTextStyleFontFamily, FontSize, Bold, Italic, Underline, Strikethrough, AllCaps, Align, Color, Opacity

Example

The following example applies a watermark preset with a single button. It crops the image to a 16:9 ratio, adds a text object in the bottom right corner, and warms up the colors.

Run several ImageEditor commands from code

RAZOR
<TelerikButton OnClick="@OnPresetButtonClick" ThemeColor="@ThemeConstants.Button.ThemeColor.Primary">
    Apply Preset
</TelerikButton>

<TelerikImageEditor @ref="@ImageEditorRef"
                    ImageUrl="images/sample-photo.jpg"
                    Width="100%"
                    Height="600px" />

@code {
    private TelerikImageEditor ImageEditorRef { get; set; }

    private async Task OnPresetButtonClick()
    {
        await ImageEditorRef.ExecuteAsync(ImageEditorCommand.CropToAspectRatio,
            new ImageEditorCropToAspectRatioArgs()
            {
                AspectRatio = 16d / 9d,
                Orientation = ImageEditorCropOrientation.Landscape
            });

        await ImageEditorRef.ExecuteAsync(ImageEditorCommand.ApplyFilter,
            new ImageEditorFilterArgs() { Filter = ImageEditorFilter.Warm });

        await ImageEditorRef.ExecuteAsync(ImageEditorCommand.AddText,
            new ImageEditorTextArgs()
            {
                Id = "watermark",
                Text = "Telerik UI for Blazor",
                Area = new ImageEditorRect() { X = 0.6, Y = 0.85, Width = 0.35, Height = 0.1 },
                Style = new ImageEditorTextStyle()
                {
                    FontFamily = "Arial",
                    FontSize = 24,
                    Bold = true,
                    Align = ImageEditorTextAlign.Right,
                    Color = "#ffffff",
                    Opacity = 0.8
                }
            });
    }
}

Next Steps

See Also