RecursiveAI.OneImage.Svg 1.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RecursiveAI.OneImage.Svg --version 1.3.0
                    
NuGet\Install-Package RecursiveAI.OneImage.Svg -Version 1.3.0
                    
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="RecursiveAI.OneImage.Svg" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RecursiveAI.OneImage.Svg" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="RecursiveAI.OneImage.Svg" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RecursiveAI.OneImage.Svg --version 1.3.0
                    
#r "nuget: RecursiveAI.OneImage.Svg, 1.3.0"
                    
#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.
#:package RecursiveAI.OneImage.Svg@1.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RecursiveAI.OneImage.Svg&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=RecursiveAI.OneImage.Svg&version=1.3.0
                    
Install as a Cake Tool

OneImage.Svg

SVG for OneImage: registers SVG (and gzip-compressed .svgz) as an image format that is drawn directly at the size you ask for. Pure C# with no dependency beyond OneImage, OneImage.Text and .NET.

dotnet add package RecursiveAI.OneImage.Svg
using OneImage;
using OneImage.Svg;

var config = new ImageConfiguration().Add(SvgFormat.Instance);   // not in ImageConfiguration.Default, so it trims away when unused
var load = new LoadOptions { Configuration = config };

ImageInfo info = Image.Identify("logo.svg", load);                       // natural size, nothing drawn
Image.Load("logo.svg", load).Resize(width: 400).Save("logo-400.png");     // drawn at 400 px, not scaled up from the natural size
Image.Thumbnail("logo.svg", 64, upscale: true, loadOptions: load).Save("logo-64.webp");

The output is 8-bit sRGB RGBA, transparent where nothing is drawn. Only the shapes under a requested region are drawn for it, so large renders stream in tiles.

What it draws

Static SVG 1.1 and SVG Tiny-style content, plus the parts of SVG 2 and CSS that documents rely on: shapes and paths with fills and strokes (caps, joins, dashes, markers), gradients and patterns, opacity, blend modes and isolated groups, transforms, nested svg, use and symbol, clip paths and masks, style sheets with the usual selectors, switch, data: images (any raster format OneImage reads, and nested SVG), the filter primitives and CSS filter functions, and text including textPath, bidirectional text, vertical writing modes and decorations.

Text needs fonts. Add font files through SvgFontOptions (TrueType, OpenType/CFF, collections, WOFF and WOFF2), or let it use the installed ones:

var fonts = new SvgFontOptions { UseSystemFonts = false };
fonts.AddFont("Roboto-Regular.ttf");
var config = new ImageConfiguration().Add(new SvgFormat(fonts: fonts));

Text whose font cannot be found draws nothing. The default font size (CSS medium) is 16 pixels, as in browsers; SvgFontOptions.DefaultFontSize changes it.

What it never does

External references (other files, URLs), @font-face, scripts, animation (SMIL) and foreignObject are never loaded or run, and the XML parser refuses DTDs and entity declarations, so a document cannot read files, reach the network or expand entities. A reference that cannot be resolved is treated as SVG's error handling says (the element is not drawn).

Limits

Documents are untrusted input. SvgLimits bounds document size, element count and nesting, attributes and names, style sheet size and matching work, use fan-out and reference depth, layers, pattern tiles, embedded images, filter size, text and path segments. A document that exceeds one fails with ImageLimitException, before the memory it would need is allocated; the load call's ImageLimits (pixels, dimension, expansion ratio) apply on top. Pass your own with new SvgFormat(new SvgLimits { ... }).

The SVG page in the repository covers the design, the limits table, how SVG features map to OneImage operations, and the conformance results.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.7.0 0 10/23/2026
1.6.0 0 10/23/2026
1.5.0 2 10/23/2026
1.4.0 37 10/23/2026
1.3.0 36 10/23/2026

See CHANGELOG.md in the repository.