Skip to content

Instantly share code, notes, and snippets.

@conholdate-gists
Created February 27, 2025 14:27
Show Gist options
  • Save conholdate-gists/408474a314764f01c15da65e51e9cfc6 to your computer and use it in GitHub Desktop.
Save conholdate-gists/408474a314764f01c15da65e51e9cfc6 to your computer and use it in GitHub Desktop.
Convert PNG to SVG Image in C# | Raster to Vector Image
// Initialize an instance of the ImageVectorizer class
var vectorizer = new Aspose.Svg.ImageVectorization.ImageVectorizer
{
// Set configuration
Configuration =
{
// Set path builder
PathBuilder = new Aspose.Svg.ImageVectorization.BezierPathBuilder {
// Set trace smoother
TraceSmoother = new Aspose.Svg.ImageVectorization.ImageTraceSmoother(1),
ErrorThreshold = 30,
MaxIterations = 30
},
ColorsLimit = 25,
LineWidth = 1
}
};
// Vectorize PNG
using var document = vectorizer.Vectorize("source.png");
// Save vectorized PNG as SVG file
document.Save("source_out.svg");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment