menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SfImageEditor - API Reference

    Show / Hide Table of Contents

    Class SfImageEditor

    The Image Editor control is a graphical user interface used for editing images. It provides built-in support for rotate, flip, zoom, and crop the images based on the selection. It also has support for inserting an Annotations including rectangle, ellipse, line, text, and freehand drawings.

    Inheritance
    System.Object
    SfBaseComponent
    SfImageEditor
    Inherited Members
    SfBaseComponent.Dispose()
    SfBaseComponent.Dispose(Boolean)
    SfBaseComponent.OnObservableChange(String, Object, Boolean, NotifyCollectionChangedEventArgs)
    Namespace: Syncfusion.Blazor.ImageEditor
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class SfImageEditor : SfBaseComponent
    Examples

    In the below code example, a basic Image Editor initialized with SfImageEditor tag directive.

     
    <SfImageEditor></SfImageEditor>

    In the below code example, a basic Image Editor initialized with SfImageEditor tag directive.

     
    <SfImageEditor></SfImageEditor>

    Constructors

    SfImageEditor()

    Declaration
    public SfImageEditor()

    Properties

    AllowUndoRedo

    Gets or sets a value indicating whether the undo and redo functionality is enabled in the SfImageEditor.

    Declaration
    public bool AllowUndoRedo { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if the undo and redo functionality is enabled; otherwise, false. The default value is true.

    Remarks

    The undo-redo history is limited to 16 actions. Therefore, after the 16th action, the first action in history is removed.

    ChildContent

    Gets or sets the child content for the SfImageEditor.

    Declaration
    public RenderFragment ChildContent { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.RenderFragment

    The value used to build the content.

    CssClass

    Gets or sets a value that indicates the CSS class string to customize the appearance of the SfImageEditor.

    Declaration
    public string CssClass { get; set; }
    Property Value
    Type Description
    System.String

    The CSS class string to customize the appearance of the control. The default value is an empty string.

    Enabled

    Gets or sets a value indicating whether the SfImageEditor is enabled to interact.

    Declaration
    public bool Enabled { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if the control is enabled; otherwise, false. The default value is true

    Height

    Gets or sets the value that indicates the height of the SfImageEditor.

    Declaration
    public string Height { get; set; }
    Property Value
    Type Description
    System.String

    A string value that can accept all types of values such as number (e.g., 950), pixel (e.g., 950px), em (950em), or a percentage (e.g., 100%), etc., to specify the height of the image editor. The default value is 100%.

    Remarks

    If the value is specified as a percentage value, then the height is based on the parent element.

    HtmlAttributes

    Gets or sets a collection of additional attributes that will applied to the SfImageEditor component.

    Declaration
    public Dictionary<string, object> HtmlAttributes { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.Object>
    Remarks

    Additional attributes can be added as inline attributes or by specifying @attributes directive.

    Examples

    In the below code example, signature height and width has been specified as style attribute in SfImageEditor.

    <SfImageEditor style="height: 100%; width: 100%;"></SfImageEditor>

    IsReadOnly

    Gets or sets a value indicating whether the SfImageEditor component is read only or not.

    Declaration
    public bool IsReadOnly { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if the read only mode is enabled; otherwise, false. The default value is false.

    ShowQuickAccessToolbar

    Gets or sets a value indicating whether the quick-access toolbar functionality is enabled in the SfImageEditor.

    Declaration
    public bool ShowQuickAccessToolbar { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if the quick access toolbar is enabled; otherwise, false. The default value is true.

    Remarks

    The quick-access toolbar will be shown once the annotations got selected. The available quick-access toolbar options are clone, delete, and edit text.

    Theme

    Gets or sets the value that indicates the theme to define the selection UI of the SfImageEditor.

    Declaration
    public Theme Theme { get; set; }
    Property Value
    Type Description
    Theme

    The possible values are, Bootstrap5 Bootstrap5Dark Tailwind TailwindDark Fluent FluentDark Bootstrap4 Bootstrap BootstrapDark Material MaterialDark Fabric FabricDark HighContrast Material3 Material3Dark

    Toolbar

    Gets or sets the value that indicates the items to define the toolbar of the SfImageEditor.

    Declaration
    public List<ImageEditorToolbarItemModel> Toolbar { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.List<ImageEditorToolbarItemModel>

    A list of ImageEditorToolbarItemModel that specifies the built-in toolbar items or custom toolbar items. The list of built-in toolbar items are Crop, Annotation, Transform, Zoom, UndoRedo, Reset, and Save.

    Remarks

    To hide the toolbar, specify an empty list. To limit the built-in toolbar items specify, { new ImageEditorToolbarItemModel() { Name = "Crop"}, new ImageEditorToolbarItemModel () {Name = "Annotation"} } If the given name matches the built-in toolbar items text, then the built-in toolbar items were rendered. To add a single custom toolbar item with the existing items, { new ImageEditorToolbarItemModel() { Name ="Crop"}, new ImageEditorToolbarItemModel() { Name ="Annotation" }, new ImageEditorToolbarItemModel() { Name = "Disabled", TooltipText = "Disabled", PrefixIcon = "e-disable"} } To provide a completely custom toolbar, use the ToolbarTemplate property instead.

    Width

    Gets or sets the value that indicates the width of the SfImageEditor.

    Declaration
    public string Width { get; set; }
    Property Value
    Type Description
    System.String

    A string value that can accept all types of values such as number (e.g., 950), pixel (e.g., 950px), em (950em), or a percentage (e.g., 100%), etc., to specify the width of the image editor. The default value is 100%.

    Remarks

    If the value is specified as a percentage value, then the width is based on the parent element.

    Methods

    ApplyImageFilterAsync(ImageFilterOption)

    Applies a filter to the image based on the provided parameter in the SfImageEditor.

    Declaration
    public Task ApplyImageFilterAsync(ImageFilterOption imageFilterOption)
    Parameters
    Type Name Description
    ImageFilterOption imageFilterOption

    Specifies the type of filter to be applied to the image. This is an Enum type property specified as ImageFilterOption.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A Task that completes when the component has finished the action.

    BuildRenderTree(RenderTreeBuilder)

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder

    ClearSelectionAsync()

    Clears the current selection in the SfImageEditor.

    Declaration
    public Task ClearSelectionAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A Task representing the asynchronous operation of clearing the selection.

    Remarks

    If no selection is currently active, this method has no effect. This method asynchronously clears the current selection and completes when the component has finished the action.

    CropAsync()

    Crops the image based on the selection in the SfImageEditor.

    Declaration
    public Task<bool> CropAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    A Task that represents the asynchronous operation of cropping the selection. It completes when the component has finished the action.

    Remarks

    The resulting image will be the selected area of the original image, and the original image will be discarded. If no selection is currently active, this method has no effect.

    DeleteShapeAsync(String)

    Deletes a shape based on the given shape ID in the SfImageEditor.

    Declaration
    public Task DeleteShapeAsync(string shapeId)
    Parameters
    Type Name Description
    System.String shapeId

    Specify the ID of the shape to be deleted.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A task that completes when the component has finished the delete action.

    Remarks

    The ID can be obtained from the public method 'GetShapesAsync'.

    DisableFreehandDrawAsync(Nullable<Boolean>)

    Disables the freehand draw option to stop freehand drawings on the canvas by mouse or touch actions in the SfImageEditor.

    Declaration
    public Task DisableFreehandDrawAsync(Nullable<bool> value)
    Parameters
    Type Name Description
    System.Nullable<System.Boolean> value
    Returns
    Type Description
    System.Threading.Tasks.Task

    A task that completes when the component has finished the action.

    Remarks

    Returns false if the user calls this method when freehand draw is already disabled.

    DrawArrowAsync(Nullable<Double>, Nullable<Double>, Nullable<Double>, Nullable<Double>, Nullable<Double>, String, ImageEditorArrowHeadType, ImageEditorArrowHeadType)

    Draw an arrow on the image in the SfImageEditor.

    Declaration
    public Task<bool> DrawArrowAsync(Nullable<double> startX = null, Nullable<double> startY = null, Nullable<double> endX = null, Nullable<double> endY = null, Nullable<double> strokeWidth = null, string strokeColor = "", ImageEditorArrowHeadType arrowStart, ImageEditorArrowHeadType arrowEnd)
    Parameters
    Type Name Description
    System.Nullable<System.Double> startX

    Optional. Specify start x- coordinates to draw an arrow. Default to center point of the image if it not specified

    System.Nullable<System.Double> startY

    Optional. Specify start y- coordinates to draw an arrow. Default to center point of the image, if it not specified

    System.Nullable<System.Double> endX

    Optional. Specify end x coordinates to draw an arrow. Default to startX plus 100, if it not specified

    System.Nullable<System.Double> endY

    Optional. Specify end y coordinates to draw an arrow. Default to startY plus 100, if it not specified.

    System.Nullable<System.Double> strokeWidth

    Optional. Specify stroke width to draw an arrow. Default to x-small if it not specified.

    System.String strokeColor

    Optional. Specify stroke color to draw an arrow. Default to white if it not specified.

    ImageEditorArrowHeadType arrowStart

    Optional. Specify the type of arrowhead for start position. Default to None if it not specified.

    ImageEditorArrowHeadType arrowEnd

    Optional. Specify the type of arrowhead for end position. Default to SolidArrow if it not specified.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    A task that completes when the component has finished the action.

    Remarks

    If the given x and y co-ordinates is not between the image range, then the arrow is not drawn on the image.

    DrawEllipseAsync(Nullable<Double>, Nullable<Double>, Nullable<Double>, Nullable<Double>, Nullable<Double>, String, String)

    Draw an ellipse on the image in the SfImageEditor.

    Declaration
    public Task<bool> DrawEllipseAsync(Nullable<double> x = null, Nullable<double> y = null, Nullable<double> radiusX = null, Nullable<double> radiusY = null, Nullable<double> strokeWidth = null, string strokeColor = "", string fillColor = "")
    Parameters
    Type Name Description
    System.Nullable<System.Double> x

    Optional. Specify X- coordinates to draw an ellipse. Default to center position of the image if this value is not specified.

    System.Nullable<System.Double> y

    Optional. Specify Y- coordinates to draw an ellipse. Default to center position of the image if this value is not specified

    System.Nullable<System.Double> radiusX

    Optional. Specify radius of x coordinates to draw an ellipse. Default to 50 if this value is not specified.

    System.Nullable<System.Double> radiusY

    Optional. Specify radius of y coordinates to draw an ellipse. Default to 50 if this value is not specified.

    System.Nullable<System.Double> strokeWidth

    Optional. Specify stroke width to draw an ellipse.

    System.String strokeColor

    Optional. Specify stroke color to draw an ellipse. Default to white if it is not specified.

    System.String fillColor

    Optional. Specify the color to fill the ellipse. Default to transparent if it not specified.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    A task that completes when the component has finished the action.

    Remarks

    If the given x and y co-ordinates is not between the image range, then the ellipse is not drawn on the image.

    DrawFrameAsync(FrameType, String, String, Int32, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, FrameLineStyle, Nullable<Int32>)

    Draws a customizable frame on the image within the SfImageEditor.

    Declaration
    public Task<bool> DrawFrameAsync(FrameType frameType, string color = "#fff", string gradientColor = "", int size = 20, Nullable<int> inset = null, Nullable<int> offset = null, Nullable<int> borderRadius = null, FrameLineStyle frameLineStyle, Nullable<int> lineCount = null)
    Parameters
    Type Name Description
    FrameType frameType

    Specifies the type of frame to be drawn on the image.

    System.String color

    Optional. Specify the color of the frame. Defaults to white ("#fff") if not specified.

    System.String gradientColor

    Optional. Specify the gradient color of the frame. Defaults to empty if not specified.

    System.Int32 size

    Optional. Specify the size of the frame as a percentage. It can be provided as an integer percentage (e.g., 10). Defaults to 20 if not specified.

    System.Nullable<System.Int32> inset

    Optional. Specify the inset value for line, hook, and inset type frames, as a percentage. It can be provided as an integer percentage (e.g., 10). Defaults to 0 if not specified.

    System.Nullable<System.Int32> offset

    Optional. Specify the offset value for line and inset type frames, as a percentage. It can be provided as an integer percentage (e.g., 10). Defaults to 0 if not specified.

    System.Nullable<System.Int32> borderRadius

    Optional. Specify the border radius for line-type frames, as a percentage. It can be provided as an integer percentage (e.g., 10). Defaults to 0 if not specified.

    FrameLineStyle frameLineStyle

    Optional. Specify the type of line to be drawn for line-type frames. Default to Solid if not specified.

    System.Nullable<System.Int32> lineCount

    Optional. Specify the number of lines for line-type frames. Defaults to 0 if not specified.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    A task representing the asynchronous operation that completes when the frame is drawn.

    Remarks

    This method allows you to add various types of frames to the image using the provided parameters. Depending on the chosen frame type, different customization options are available. Use this method within the context of an SfImageEditor instance.

    DrawImageAsync(String, Nullable<Double>, Nullable<Double>, Nullable<Int32>, Nullable<Int32>, Nullable<Boolean>, Nullable<Int32>)

    Draws an image annotation on the image in the SfImageEditor.

    Declaration
    public Task<bool> DrawImageAsync(string data, Nullable<double> x = null, Nullable<double> y = null, Nullable<int> width = null, Nullable<int> height = null, Nullable<bool> isAspectRatio, Nullable<int> degree = null)
    Parameters
    Type Name Description
    System.String data

    Specifies the URL or image data of the image to be annotated.

    System.Nullable<System.Double> x

    Optional. Specifies the x-coordinate of the starting point for the image annotation. Default to center point of the image, if it is not specified.

    System.Nullable<System.Double> y

    Optional. Specifies the y-coordinate of the starting point for the image annotation. Default to center point of the image, if it is not specified.

    System.Nullable<System.Int32> width

    Optional. Specifies the width of the image annotation. Default size is calculated based on the aspect ratio of the image, if it is not specified.

    System.Nullable<System.Int32> height

    Optional. Specifies the height of the image annotation. Default size is calculated based on the aspect ratio of the image, if it is not specified.

    System.Nullable<System.Boolean> isAspectRatio

    Optional. If set to true, maintains the image's aspect ratio based on the width value during resizing. Default to true, if it is not specified

    System.Nullable<System.Int32> degree

    Optional. Specifies the degree for the image annotation. Default to 0 degree of the image, if it is not specified.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    True if the image annotation was successfully drawn; otherwise, false.

    DrawLineAsync(Nullable<Double>, Nullable<Double>, Nullable<Double>, Nullable<Double>, Nullable<Double>, String)

    Draw line on the image in the SfImageEditor.

    Declaration
    public Task<bool> DrawLineAsync(Nullable<double> startX = null, Nullable<double> startY = null, Nullable<double> endX = null, Nullable<double> endY = null, Nullable<double> strokeWidth = null, string strokeColor = "")
    Parameters
    Type Name Description
    System.Nullable<System.Double> startX

    Optional. Specify start x- coordinates to draw a line. Default to center point of the image if it not specified

    System.Nullable<System.Double> startY

    Optional. Specify start y- coordinates to draw a line. Default to center point of the image, if it not specified

    System.Nullable<System.Double> endX

    Optional. Specify end x coordinates to draw a line. Default to startX plus 100, if it not specified

    System.Nullable<System.Double> endY

    Optional. Specify end y coordinates to draw a line. Default to startY plus 100, if it not specified.

    System.Nullable<System.Double> strokeWidth

    Optional. Specify stroke width to draw a line. Default to x-small if it not specified.

    System.String strokeColor

    Optional. Specify stroke color to draw a line. Default to white if it not specified.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    A task that completes when the component has finished the action.

    Remarks

    If the given x and y co-ordinates is not between the image range, then the line is not drawn on the image.

    DrawPathAsync(ImageEditorPoint[], Nullable<Double>, String)

    Draw a path on the image in the SfImageEditor.

    Declaration
    public Task<bool> DrawPathAsync(ImageEditorPoint[] points, Nullable<double> strokeWidth = null, string strokeColor = "")
    Parameters
    Type Name Description
    ImageEditorPoint[] points

    Optional. Specify collection of x and y coordinates as ImageEditorPoint to draw a path. Default to draw a single path from the center point of the image if it not specified

    System.Nullable<System.Double> strokeWidth

    Optional. Specify stroke width to draw a path. Default to x-small if it not specified.

    System.String strokeColor

    Optional. Specify stroke color to draw a path. Default to white if it not specified.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    A task that completes when the component has finished the action.

    Remarks

    If the given x and y co-ordinates is not between the image range, then the arrow is not drawn on the image.

    DrawRectangleAsync(Nullable<Double>, Nullable<Double>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, String, String)

    Draw rectangle on the image in the SfImageEditor.

    Declaration
    public Task<bool> DrawRectangleAsync(Nullable<double> x = null, Nullable<double> y = null, Nullable<int> width = null, Nullable<int> height = null, Nullable<int> strokeWidth = null, string strokeColor = "", string fillColor = "")
    Parameters
    Type Name Description
    System.Nullable<System.Double> x

    Optional. Specify X- coordinates to draw a rectangle. Default to center point of the image, if it not specified.

    System.Nullable<System.Double> y

    Optional. Specify Y- coordinates to draw a rectangle. Default to center point of the image, if it not specified.

    System.Nullable<System.Int32> width

    Optional. Specify width to draw a rectangle from the start point. Default to 100, if it not specified.

    System.Nullable<System.Int32> height

    Optional. Specify height to draw a rectangle from the start point. Default to 50, if it not specified.

    System.Nullable<System.Int32> strokeWidth

    Optional. Specify stroke width to draw a rectangle. Default to x-small size if it not specified.

    System.String strokeColor

    Optional. Specify stroke color to draw a rectangle. Default to white color if it not specified.

    System.String fillColor

    Optional. Specify the color to fill the rectangle. Default to transparent if it not specified

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    A task that completes when the component has finished the action.

    Remarks

    If the given x and y co-ordinates is not between the image range, then the rectangle is not drawn on the image.

    DrawTextAsync(Nullable<Double>, Nullable<Double>, String, String, Nullable<Int32>, Boolean, Boolean, String)

    Draw text based on the image in the SfImageEditor.

    Declaration
    public Task<bool> DrawTextAsync(Nullable<double> x = null, Nullable<double> y = null, string text = "", string fontFamily = "", Nullable<int> fontSize = null, bool bold = false, bool italic = false, string color = "")
    Parameters
    Type Name Description
    System.Nullable<System.Double> x

    Optional. Specify X- coordinates to draw a text. Default to center point of the image if it not specified.

    System.Nullable<System.Double> y

    Optional. Specify Y- coordinates to draw a text. Default to center point of the image if it not specified.

    System.String text

    Optional. Specify text to be drawn. Default to "Enter Text" if it not specified.

    System.String fontFamily

    Optional. Specify font family for the text to be drawn on an image. Default "Arial" if it not specified.

    System.Nullable<System.Int32> fontSize

    Optional. Specify font size for the text to be drawn on an image. Default to x-small size if it not specified.

    System.Boolean bold

    Optional. Specify the bold style to the text to be drawn. Default to false if it not specified.

    System.Boolean italic

    Optional. Specify the italic style to the text to be drawn. Default to false if it not specified.

    System.String color

    Optional. Specify the text color.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    A task that completes when the component has finished the action.

    Remarks

    If the given x and y co-ordinates is not between the image range, then the text is not drawn on the image.

    EnableFreehandDrawAsync(Nullable<Boolean>)

    Enables the freehand draw option to draw freehand drawings on the canvas by mouse or touch actions in the SfImageEditor

    Declaration
    public Task EnableFreehandDrawAsync(Nullable<bool> value)
    Parameters
    Type Name Description
    System.Nullable<System.Boolean> value
    Returns
    Type Description
    System.Threading.Tasks.Task

    A task that completes when the component has finished the action.

    Remarks

    Returns false if the user calls this method when freehand draw is already enabled.

    ExportAsync(String, ImageEditorFileType)

    Exports the image from the SfImageEditor based on the provided file type and file name.

    Declaration
    public Task ExportAsync(string fileName = "", ImageEditorFileType fileType)
    Parameters
    Type Name Description
    System.String fileName

    Optional. Specifies the name of the image file to export. Default to the original image name if it is not specified.

    ImageEditorFileType fileType

    Optional. Specifies the type of image file to export. This is an Enum type property specified as ImageEditorFileType. Default to "PNG" if not specified.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A Task that completes when the export action has finished.

    Remarks

    The "FileName" parameter should be null if the user wants to change only the type of image.

    FinetuneImageAsync(ImageFinetuneOption, Int32)

    Applies color correction or adjustment to an image based on the provided parameters in the SfImageEditor.

    Declaration
    public Task FinetuneImageAsync(ImageFinetuneOption finetuneOption, int value)
    Parameters
    Type Name Description
    ImageFinetuneOption finetuneOption

    Specify the type of finetune to be performed to an image. This the Enum type property which is specified as ImageFinetuneOption.

    System.Int32 value

    Specify the value to be applied for finetune in an image.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A Task that completes when the component has finished the action.

    Remarks

    The given value is exceeding the range of minimum and maximum value specified in the Syncfusion.Blazor.ImageEditor.SfImageEditor.FinetuneSettings, then finetune is not going to be performed.

    FlipAsync(ImageEditorDirection)

    Flips the image in the specified direction in the SfImageEditor.

    Declaration
    public Task FlipAsync(ImageEditorDirection direction)
    Parameters
    Type Name Description
    ImageEditorDirection direction

    Specifies the direction to flip the image. This is an Enum property of the type ImageEditorDirection.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A Task that represents the asynchronous operation of flipping the image. It completes when the component has finished the action.

    Remarks

    The possible values for the ImageEditorDirection Enum are "Horizontal" and "Vertical".

    GetImageDataAsync()

    Gets the current image data from the SfImageEditor.

    Declaration
    public Task<object> GetImageDataAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Object>

    A Task that completes when the component has finished the action.

    Remarks

    The value returned from this method is used to render the image in the HTML canvas as well as our image editor using OpenAsync(Object) method.

    GetImageDataUrlAsync()

    Gets the current image data url from the SfImageEditor.

    Declaration
    public Task<string> GetImageDataUrlAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    A Task that completes when the component has finished the action.

    Remarks

    The value returned from this method is used to save the edited image to database as well as open in our image editor using OpenAsync(Object) method.

    GetImageDimensionAsync()

    Gets the image dimension after cropping the image in the SfImageEditor.

    Declaration
    public Task<ImageDimension> GetImageDimensionAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<ImageDimension>

    A ImageDimension to get the current position and size of the image in the SfImageEditor.

    GetShapesAsync()

    Gets all the shapes inserted into the SfImageEditor.

    Declaration
    public Task<ShapeSettings[]> GetShapesAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<ShapeSettings[]>

    It returns the shape collection as ShapeSettings. The available values in a shape setting are, height, width, stroke color, fill Color, stroke width, radius, text, font size, font style.

    Remarks

    This method returns all the shapes inserted in this SfImageEditor.

    ImageResizeAsync(Nullable<Int32>, Nullable<Int32>, Nullable<Boolean>)

    Resize an image by adjusting its dimensions.

    Declaration
    public Task<bool> ImageResizeAsync(Nullable<int> width = null, Nullable<int> height = null, Nullable<bool> isAspectRatio)
    Parameters
    Type Name Description
    System.Nullable<System.Int32> width

    The new width of the image.

    System.Nullable<System.Int32> height

    The new height of the image.

    System.Nullable<System.Boolean> isAspectRatio

    Optional. If set to true, maintains the image's aspect ratio based on the width value during resizing. Default to true, if it is not specified

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    True if the resizing operation was successful; otherwise, false.

    OnAfterRenderAsync(Boolean)

    Declaration
    protected override Task OnAfterRenderAsync(bool firstRender)
    Parameters
    Type Name Description
    System.Boolean firstRender
    Returns
    Type Description
    System.Threading.Tasks.Task
    Overrides
    SfBaseComponent.OnAfterRenderAsync(Boolean)

    OnInitializedAsync()

    Triggered when the component is initialized.

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task
    Overrides
    SfBaseComponent.OnInitializedAsync()

    OnParametersSetAsync()

    Triggered when the component is loaded.

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    OpenAsync(Object)

    Opens an image in SfImageEditor as URL or image data.

    Declaration
    public Task OpenAsync(object data)
    Parameters
    Type Name Description
    System.Object data

    The url of the image or image data to open in the editor.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A Task that completes when the component has finished the action.

    Remarks

    This method can be useful if the user get the image data using GetImageDataAsync() method.

    RedoAsync()

    Redo the last user action that was undone by the user or undo method in the SfImageEditor.

    Declaration
    public Task RedoAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A Task that completes when the component has finished the redo action.

    Remarks

    This method can only be performed if the AllowUndoRedo property is set to true and there is a previous action that was undone.

    RefreshAsync()

    The method is used to re-render the image editor.

    Declaration
    public Task RefreshAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    ResetAsync()

    Resets any customizations that have been made to the image since it was loaded in the SfImageEditor and restoring it to its original state.

    Declaration
    public Task ResetAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A Task that completes when the component has finished the action.

    Remarks

    This method can be useful if the user has made multiple changes to the image and wishes to start over from the original version.

    RotateAsync(Int32)

    Rotates the image clockwise or counterclockwise based on the provided degree in the SfImageEditor.

    Declaration
    public Task<bool> RotateAsync(int degree)
    Parameters
    Type Name Description
    System.Int32 degree

    Specifies the degree to rotate the image. If the degree is a positive value, the image is rotated clockwise. If the degree is a negative value, the image is rotated counterclockwise.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    A Task that completes when the rotation is finished.

    Remarks

    The degree values must be 0, 90, 180, 270, 360, and its negative values.

    SelectAsync(String, Nullable<Double>, Nullable<Double>, Nullable<Double>, Nullable<Double>)

    Selects a region of the image to perform cropping based on the provided type and region parameters in the SfImageEditor.

    Declaration
    public Task SelectAsync(string type, Nullable<double> startX = null, Nullable<double> startY = null, Nullable<double> width = null, Nullable<double> height = null)
    Parameters
    Type Name Description
    System.String type

    Optional. Specifies the type of selection to be cropped. The default value is "custom" and the possible values are "rectangle", "ellipse", and "custom".

    System.Nullable<System.Double> startX

    Optional. Specifies the starting x position to begin the selection. Default to center of the image editor if it is not specified.

    System.Nullable<System.Double> startY

    Optional. Specifies the starting y position to begin the selection. Default to center of the SfImageEditor if it is not specified.

    System.Nullable<System.Double> width

    Optional. Specifies the width of the selection. Default to half of the image editor width if it is not specified.

    System.Nullable<System.Double> height

    Optional. Specifies the height of the selection. Default to half of the image editor height if it is not specified.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A Task that completes when the component has finished the action.

    SelectShapeAsync(String)

    Selects a shape based on the provided shape ID in the SfImageEditor.

    Declaration
    public Task<bool> SelectShapeAsync(string shapeId)
    Parameters
    Type Name Description
    System.String shapeId

    Specify the ID of the shape to be selected.

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean>

    A task that completes when the component has finished the action.

    Remarks

    The ID can be obtained using the public method GetShapesAsync().

    UndoAsync()

    Reverse the last action which performed by the user in the SfImageEditor.

    Declaration
    public Task UndoAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A Task that completes when the component has finished the undo action.

    Remarks

    This method can only be performed if the AllowUndoRedo property is set to true and there is a previous action to undo.

    ZoomAsync(Double, ImageEditorPoint)

    Zooms the image in or out based on the specified value in the SfImageEditor.

    Declaration
    public Task ZoomAsync(double zoomFactor, ImageEditorPoint zoomPoint = null)
    Parameters
    Type Name Description
    System.Double zoomFactor

    Specifies the zoom factor to perform zooming. The minimum and maximum zoom factor has defined in the Syncfusion.Blazor.ImageEditor.SfImageEditor.ZoomSettings property.

    ImageEditorPoint zoomPoint

    Optional. Specifies the point in which the zoom in/out operation performed in an image editor using ImageEditorPoint.

    Returns
    Type Description
    System.Threading.Tasks.Task

    A task that completes when the zoom operation has finished.

    Remarks

    If the given zoom factor value is exceeding the range of minimum and maximum zoom factor, then the zooming cannot be performed.

    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved