BlazorSvgEditor 1.2.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package BlazorSvgEditor --version 1.2.3                
NuGet\Install-Package BlazorSvgEditor -Version 1.2.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BlazorSvgEditor" Version="1.2.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BlazorSvgEditor --version 1.2.3                
#r "nuget: BlazorSvgEditor, 1.2.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BlazorSvgEditor as a Cake Addin
#addin nuget:?package=BlazorSvgEditor&version=1.2.3

// Install BlazorSvgEditor as a Cake Tool
#tool nuget:?package=BlazorSvgEditor&version=1.2.3                

Blazor Svg Editor

Blazor Svg Editor is a simple SVG editor for Blazor that allows annotations (in the form of SVG elements) to be placed on images. You are able to scale and translate the image (of course with the annotations). Actually it supports circles, rectangles and polygons - but because of the abstract interface they can be easily extended. The shapes are movable and resizable. It is also checked that the shapes are not placed outside the image.

Demo

A demo application is hosted by GitHub-Pages. You can visit it here.

Documentation

Avaiable Properties

  • CssClass/CssStyle: Own classes and Styles for the component
  • MinScale/MaxScale
  • ImageManipulations: A class with properties for brightness, contrast, saturation and hue - they get applied on the loaded image
  • ImageSize: Set image height and width
  • ImageSource: There are two ways:
    • Directly: (via Propertie ImageSource)
    • ImageSourceLoadingFunc: A async func which loads the image source string (e.g. when you get a base64 string from an api)
  • OnShapeChanged: Event when Shapes get changed (with information about the ChangeType and the affected shape
  • bind-SelectedShapeId: The id from the selected shape (can also be set from outside)

Sample Code for Implementation

Here is a sample code for the implementation.

<SvgEditor @ref="svgEditor" CssClass="class" MinScale="0.8" ImageSize="(1000,750)" ImageManipulations="ImageManipulations" OnShapeChanged="EditorShapeChanged" ImageSourceLoadingFunc="GetImageSource" @bind-SelectedShapeId="SelectedShapeId">  

The used ImageLoadFunc look as follows:

private async Task<string> GetImageSource()  
{  
    await Task.Delay(1000);  //An async api call is also possible...
    return "https://url-to-image.de"; 
}

For the other methods please take a look at the example project in the GitHub Repository.

Questions, Ideas, Feedback?

You can visit the GitHub Repository here. Please report bugs or request new features by opening an issue. You can also make an Pull-Request when you implement a new feature.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.6.2 372 4/7/2024
1.6.1 149 3/30/2024
1.6.0 210 3/8/2024
1.5.1 473 12/22/2023
1.5.0 399 12/22/2023
1.4.0 742 6/5/2023
1.3.0 754 3/21/2023
1.2.5 748 3/3/2023
1.2.4 733 3/3/2023
1.2.3 709 3/2/2023
1.2.2 749 2/19/2023
1.2.1 751 2/10/2023
1.2.0 745 2/10/2023
1.1.2 773 2/8/2023
1.1.1 755 2/8/2023