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

Telerik Image Editor component for viewing and editing raster images in Blazor applications. Provides a toolbar, a tool sidebar, contextual tool panes, and an editing canvas.

Definition

Namespace:Telerik.Blazor.Components

Assembly:Telerik.Blazor.dll

Syntax:

C#
public class TelerikImageEditor : BaseComponent, IComponent, IHandleEvent, IHandleAfterRender, IDisposable

Inheritance: objectComponentBaseBaseComponentTelerikImageEditor

Implements: IComponentIDisposableIHandleAfterRenderIHandleEvent

Inherited Members BaseComponent.ShouldRender()BaseComponent.OnInitializedAsync()BaseComponent.InitLocalizer()BaseComponent.ThrowIfParameterIsNull(object, string)BaseComponent.HaveOptionsChanged(IDictionary<string, object>, IDictionary<string, object>)BaseComponent.GetClassString(params string[])BaseComponent.InvokeAsync<T>(string, params object[])BaseComponent.InvokeAsync<T>(string, CancellationToken, params object[])BaseComponent.InvokeVoidAsync(string, params object[])BaseComponent.InvokeVoidAsyncWithoutAwait(string, params object[])BaseComponent.InvokeComponentMethodAsync<T>(string, params object[])BaseComponent.InvokeComponentMethodAsync<T>(string, CancellationToken, params object[])BaseComponent.InvokeVoidComponentMethodAsync(string, params object[])BaseComponent.InvokeComponentVoidMethodAsync(string, object)BaseComponent.InvokeDisposeAsync()BaseComponent.StateHasChanged()BaseComponent.RootComponentBaseComponent.ClassComponentBase.OnInitialized()ComponentBase.OnParametersSetAsync()ComponentBase.OnAfterRender(bool)ComponentBase.InvokeAsync(Action)ComponentBase.InvokeAsync(Func<Task>)ComponentBase.DispatchExceptionAsync(Exception)ComponentBase.SetParametersAsync(ParameterView)...

Constructors

C#
public TelerikImageEditor()

Properties

Controls whether the component renders its adaptive (mobile) layout. When set to Auto, the canvas renders first and the tool pane and sidebar are docked at the bottom.

C#
[Parameter]
public AdaptiveMode AdaptiveMode { get; set; }

The image to load as a byte array. Set a new array instance to load another image. Set null or an empty array to clear the editor.

C#
[Parameter]
public byte[] Data { get; set; }
C#
[CascadingParameter]
public DialogFactory DialogFactory { get; set; }

Controls the height of the editing area (canvas, sidebar and tool pane) using any valid CSS unit like "600px".

C#
[Parameter]
public string Height { get; set; }

Defines a render fragment that contains the settings of the Image Editor. Children: ImageEditorFileSelectSettings.

C#
[Parameter]
public RenderFragment ImageEditorSettings { get; set; }

The URL of the image to load, for example "images/photo.png". Data takes precedence when both are set; the URL loads when Data is null or empty. Images from another origin must allow CORS, otherwise loading fails and OnError fires.

C#
[Parameter]
public string ImageUrl { get; set; }

Fires when loading, editing, rendering, or exporting an image fails.

C#
[Parameter]
public EventCallback<ImageEditorErrorEventArgs> OnError { get; set; }

Fires after the ImageEditor applies, undoes, or redoes an edit from any tool, such as crop, rotate, filter, text, shapes, or blur. Use it to track or log user actions from one place. Zoom, pan, and live previews do not fire the event.

C#
[Parameter]
public EventCallback<ImageEditorExecuteEventArgs> OnExecute { get; set; }

Fires before downloading the edited image. Set IsCancelled to prevent the download.

C#
[Parameter]
public EventCallback<ImageEditorExportEventArgs> OnExport { get; set; }

Fires before the ImageEditor opens an image from a selected file, Data, or ImageUrl. Provides the file name, extension, size, and pixel dimensions of the image. Set IsCancelled to prevent opening.

C#
[Parameter]
public EventCallback<ImageEditorOpenEventArgs> OnOpen { get; set; }

Controls the component width using any valid CSS unit like "100%" or "800px".

C#
[Parameter]
public string Width { get; set; }

Methods

C#
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters:__builderRenderTreeBuilder

Overrides: ComponentBase.BuildRenderTree(RenderTreeBuilder)

C#
public override void Dispose()

Overrides: BaseComponent.Dispose()

Runs an editor command from code, for example ExecuteAsync(ImageEditorCommand.Rotate, new ImageEditorAngleArgs { Angle = 90 }). Uses the same commands and argument classes that the OnExecute event reports. The edit is added to the undo history.

C#
public Task ExecuteAsync(ImageEditorCommand command, ImageEditorCommandArgs args)
Parameters:commandImageEditorCommand

The command to run.

argsImageEditorCommandArgs

The command arguments. Use the class that the command value documents. Pass null for commands without arguments.

Returns:

Task

Exceptions: ArgumentException

The arguments do not match the command.

Runs an editor command that has no arguments, for example ResetCrop. The edit is added to the undo history.

C#
public Task ExecuteAsync(ImageEditorCommand command)
Parameters:commandImageEditorCommand

The command to run.

Returns:

Task

Gets the edited image as a byte array, including all edits such as crop, filters, text, and shapes. The image uses the current export format.

C#
public Task<byte[]> GetFileAsync()
Returns:

Task<byte[]>

A task that represents the asynchronous operation. The task result contains the image data as a byte array, or null if no image is loaded.

C#
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters:firstRenderboolReturns:

Task

Overrides: BaseComponent.OnAfterRenderAsync(bool)

C#
protected override void OnParametersSet()

Overrides: ComponentBase.OnParametersSet()