Optimize SVG Online or using C#

SVG Optimizer lets you clean SVG and reduce the size of created or opened with our C# library SVG files.

How to Optimize SVG

If you want to reduce the size of your SVG documents or remove useless elements or attributes, you can use Aspose.SVG for .NET API which is a feature-rich, powerful and easy-to-use document manipulation with SVG DOM for the C# platform.

Optimize SVG with Aspose.SVG for .NET API in real-time! Please load an SVG file from the local file system and you will immediately get the result.



SVG Optimization in C#

Aspose.SVG C# library provides the SVGOptimizer class that is designed to optimize SVG files. The Optimize() method optimizes SVGDocument by applying a set of specified optimization options. A high-speed C# library allows .NET developers to optimize SVG with a few lines of code:

Optimize SVG file – C#

// Initialize an SVG document from a file to optimize 
using (var document = new SVGDocument("document.svg"))
{
    // Optimize SVG with default options
    SVGOptimizer.Optimize(document);  

    // Save optimized SVG document     
    document.Save("optimized_document.svg");     
}

Steps to Optimize SVG in C#

  • Add an Aspose.SVG for .NET library reference to your C# project.
  • Initialize an SVG document from a file using the SVGDocument() constructor.
  • Use the Optimize() method to clean SVG with default optimization options.
  • Call the Save() method to save the optimized SVG document to the specified path.

FAQ

1. How can I optimize SVG?

Aspose.SVG allows you to optimize SVG online or programmatically. For example, you can clean SVG in real-time using Online SVG Optimizer which removes superfluous data and reduces the size of SVG files. On other hand, you can use Aspose.SVG for .NET API to optimize SVG files programmatically.

2. Why Optimize SVG?

Using SVG images provides a significant improvement in website loading times. But SVG codes can be full of irrelevant attributes and unnecessary comments, making the resulting file much heavier. As soon as we remove unnecessary code, the file size will be significantly reduced, which will speed up the website loading speed. In addition, optimized SVGs provide better SEO results – faster load times and ensure flawless scaling on any device.

Installing Aspose.SVG for .NET library

If you are interested in developing scalable vector graphics and their application, install our flexible, high-speed Aspose.SVG for .NET API with a powerful set of interfaces for C# and other .NET programming languages.
Install from command line as nuget install Aspose.SVG or via Package Manager Console of Visual Studio with Install-Package Aspose.SVG. Alternatively, get the offline MSI installer or DLLs in a ZIP file from downloads. Aspose.SVG for .NET API is a standalone library and does not depend on any software for SVG document processing.
For more details about C# library installation and system requirements, please refer to Aspose.SVG Documentation.

Other Supported Aspose.SVG for .NET API Features

Use the Aspose.SVG C# library to convert, merge, edit SVG documents, convert color codes, vectorize images and more!