Aspose.SVG for .NET is a flexible library for SVG file processing and fully compatible with its specifications. API can easily load, save and convert SVG files as well as read and traverse the elements of files through its Document Object Model (DOM). API is independent of any other software and empowers developers to work with SVG files without going into the underlying details of the format. Using Aspose.SVG C# library in your project allows you to perform the following tasks:
- Create or load SVG documents from a file, URL, string, stream, etc.
- Convert SVG to PDF, PNG, and other popular formats.
- Vectorize raster images such as PNG, JPG, BMP, TIFF, GIF, and ICO into an SVG document.
- Navigate SVG documents using XPath Query, CSS Selector, Element and Document Traversal features.
- Edit SVG files by inserting new nodes, removing, or editing the content of existing nodes.
- Render SVG documents with high quality.
- Vectorize SVG text in a short time and with professional quality and resolution, and more.
Advanced Features of Aspose.SVG for .NET API
Edit and Save SVG files
Full control over SVG nodes
Change the node properties
Content navigation using XPath Query
Navigate via CSS Selectors, Element and Document Traversal
Convert SVG using C#
Aspose.SVG for .NET can read and convert SVG to PDF, XPS and major image formats. The conversion process is simple and reliable, thus making SVG .NET API a perfect choice. You can use API in your C# or any other .NET application to develop converter applications without getting into the details of underlying file formats. Getting conversion functionality is simple and depends on each application requirement. Here are a few lines of code for conversion between formats.
Convert SVG to PNG – C#
using Aspose.Svg;
using System.IO;
using Aspose.Svg.Saving;
using Aspose.Svg.Converters;
...
// Initialize an SVG document from a file
using (var document = new SVGDocument("input.svg"))
{
// Create an instance of the ImageSaveOptions class
var pngSaveOptions = new ImageSaveOptions();
// Convert SVG to PNG
Converter.ConvertSVG(document, pngSaveOptions, "output.png");
}
You can try online SVG Converter by following the link.
Other Supported SVG Conversions:
Convert Raster Image to Vector Graphic
Converting an image to vector is very easy using Aspose.SVG API. The ImageVectorization Namespace includes classes and interfaces for implementing the image vectorization process. The following code snippet demonstrates the use of the ImageVectorizer class for image vectorization:
Convert Image to Vector – C#
using Aspose.Svg.ImageVectorization;
using Aspose.Svg.Saving;
...
// Initialize an instance of the ImageVectorizer class
var vectorizer = new ImageVectorizer
{
Configuration =
{
TraceSmoother = new ImageTraceSmoother(1),
TraceSimplifier = new ImageTraceSimplifier(0.5f),
ColorsLimit = 3
}
};
// Vectorize raster image from the specified file
using var document = vectorizer.Vectorize("input.png");
// Save vectorized image as SVG file
document.Save("output.svg");
You can try free online Image Vectorizer.
Other Supported Vectorizers:
Merge SVG in C#
The Renderer() method gives you the ability to send multiple documents at once to the output rendering device and merge them. Documents merging can be done with a few lines of code:
Merge SVG to PDF – C#
using Aspose.Svg;
using Aspose.Svg.Rendering;
using Aspose.Svg.Rendering.Pdf;
...
// Initialize SVG documents from files to merge later
using (var document1 = new SVGDocument("input1.svg"))
using (var document2 = new SVGDocument("input2.svg"))
using (var document3 = new SVGDocument("input3.svg"))
{
// Create an instance of SvgRenderer
using (var renderer = new SvgRenderer())
{
// Create an instance of PdfDevice
using (var device = new PdfDevice("output.pdf"))
{
// Merge all SVG documents to PDF
renderer.Render(device, document1, document2, document3);
}
}
}
Other Supported Mergers:
Support and Learning Resources
- Learning Resources
- Documentation
- Source Code
- API References
- Product Support
- Free Support
- Paid Support
- Blog
- Why Aspose.SVG for .NET?
- Customers List
- Success Stories