Skia SVG rendering library.
The Svg.Skia
is using internally SVG library from NuGet to load Svg
object model. The original Svg
library provides only System.Drawing
rendering backend. The Svg.Skia
library is providing rendering backend implementation using SkiaSharp
that aims to be at least on par or more complete then original System.Drawing
implementation and also more performant. The Svg.Skia
can be also be used in same way as the SkiaSharp.Extended.Svg (load svg
files as SKPicture
). The Svg
library has more complete implementation of Svg
document model then SkiaSharp.Extended.Svg and the Svg.Skia
renderer will provide more complete rendering subsystem implementation.
Svg.Skia is delivered as a NuGet package.
You can find the packages here NuGet and install the package like this:
Install-Package Svg.Skia
or by using nightly build feed:
- Add
https://www.myget.org/F/svgskia-nightly/api/v2
to your package sources - Alternative nightly build feed
https://pkgs.dev.azure.com/wieslawsoltes/GitHub/_packaging/CI/nuget/v3/index.json
- Update your package using
Svg.Skia
feed
and install the package like this:
Install-Package Svg.Skia -Pre
dotnet add package Svg.Skia
using SkiaSharp;
using Svg.Skia;
var svg = new SKSvg();
svg.Load("image.svg");
SKCanvas canvas = ...
canvas.DrawPicture(svg.Picture);
using SkiaSharp;
using Svg.Skia;
using (var svg = new SKSvg())
{
if (svg.Load("image.svg") != null)
{
svg.Save("image.png", SKEncodedImageFormat.Png, 100, 1f, 1f);
}
}
using SkiaSharp;
using Svg.Skia;
using (var svg = new SKSvg())
{
if (svg.Load("image.svgz") != null)
{
svg.Save("image.png", SKEncodedImageFormat.Png, 100, 1f, 1f);
}
}
dotnet tool install -g Svg.Skia.Converter
Svg.Skia.Converter:
Converts a svg file to an encoded bitmap image.
Usage:
Svg.Skia.Converter [options]
Options:
-f, --files <files> The relative or absolute path to the input files
-d, --directories <directories> The relative or absolute path to the input directories
-o, --output <output> The relative or absolute path to the output directory
-p, --pattern <pattern> The search string to match against the names of files in the input directory
--format <format> The output image format
-q, --quality <quality> The output image quality
-b, --background <background> The output image background
-s, --scale <scale> The output image horizontal and vertical scaling factor
-sx, --scaleX <scalex> The output image horizontal scaling factor
-sy, --scaleY <scaley> The output image vertical scaling factor
--quiet Set verbosity level to quiet
-c, --load-config <load-config> The relative or absolute path to the config file
--save-config <save-config> The relative or absolute path to the config file
--version Display version information
To build the projects you need to install .NET Core 3.0 version SDK 3.0.100
.
git clone [email protected]:wieslawsoltes/Svg.Skia.git
cd Svg.Skia
git submodule update --init --recursive
dotnet build -c Release
The Svg.Skia
library is using code from the https://github.com/vvvv/SVG
Svg.Skia is licensed under the MIT license.