Created
February 27, 2025 14:27
-
-
Save conholdate-gists/408474a314764f01c15da65e51e9cfc6 to your computer and use it in GitHub Desktop.
Convert PNG to SVG Image in C# | Raster to Vector Image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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