Browse our Products

Aspose.SVG for .NET 22.10 Release Notes

Major Features

As per the regular monthly update process of all APIs being offered by Aspose, we are honored to announce the October release of Aspose.SVG for .NET:

We have added a new SVGOptimizer tool to optimize SVG documents, which provides functionality to remove redundant and useless information and reduce the size of SVG path elements through vector graphics optimization. It also provides the possibility of flexible optimization control through the use of various options.

Public API changes:

Added APIs:

SVGOptimizer class

SVGOptimizer is a static class designed to optimize SVG documents. By optimization, we mean removing unused or invisible elements and their attributes, merging groups, and reducing the size of path segments.

public static class SVGOptimizer
Methods
NameDescription
static Optimize(SVGDocument)Optimizes SVGDocument by applying a set of default optimization options.
static Optimize(SVGDocument, SVGOptimizationOptions)Optimizes SVGDocument by applying a set of specified optimization options.

SVGOptimizationOptions class

SVGOptimizationOptions is a class for storing options for optimizing SVG documents.

public class SVGOptimizationOptions
Constructors
NameDescription
SVGOptimizationOptions()Initializes a new instance of the SVGOptimizationOptions class.
Properties
NameDescription
CollapseGroups { get; set; }Gets or sets the option to collapse excess groups. It is ’true’ by default.
PathOptimizationOptions { get; set; }Gets or sets the option SVGPathOptimizationOptions. If this option is null, then path element optimization will not be performed.
RemoveDescriptions { get; set; }Gets or sets the option to remove only editors content or empty elements. It is ’true’ by default.
RemoveEmptyAttributes { get; set; }Gets or sets the option to remove attributes with empty values. It is ’true’ by default.
RemoveEmptyContainers { get; set; }Gets or sets the option to remove empty containers. It is ’true’ by default.
RemoveEmptyText { get; set; }Gets or sets the option to remove empty Text elements. It is ’true’ by default.
RemoveHiddenElements { get; set; }Gets or sets the option to remove elements that are not visible during rendering. It is ’true’ by default.
RemoveMetadata { get; set; }Gets or sets the option to remove metadata. It is ’true’ by default.
RemoveUnusedDefs { get; set; }Gets of sets the option to remove the content of defs that are not displayed directly without identifiers. It is ’true’ by default.
RemoveUnusedNamespaces { get; set; }Gets or sets the option to remove the declaration of unused namespaces from the SVG element that are not used in elements or attributes. It is ’true’ by default.

SVGPathOptimizationOptions class

SVGPathOptimizationOptions is a class for storing options for optimizing segments of SVG path elements.

public class SVGPathOptimizationOptions
Constructors
NameDescription
SVGPathOptimizationOptions()Initializes a new instance of the SVGPathOptimizationOptions class.
Properties
NameDescription
ApplyTransforms { get; set; }Gets or sets the option to apply transformations to the Path segments. It is ‘false’ by default.
ArcBuildingThreshold { get; set; }Gets or sets the parameter value used as the threshold error for replacing Bezier segments with arc segments. It is ‘2.5’ by default.
ArcBuildingTolerance { get; set; }Gets or sets the parameter value used as the percentage of radius for replacing Bezier segments with arc segments. It is ‘0.5’ by default.
FloatPrecision { get; set; }Gets or sets the option to round a float-precision floating-point value to a specified number of fractional digits. It is ‘3’ by default.
RemoveSpaceAfterFlags { get; set; }Gets or sets the option to remove extra space after ‘arcto’ command flags. It is ‘false’ by default.