This Gist contains practical C# code examples from the Image and Text Vectorization chapter of the Aspose.SVG for .NET documentation. These examples illustrate how to convert raster images and text to vector SVG graphics using ImageVectorizer and save text elements as vector paths.
- Simple Image Vectorization – Convert raster images like PNG and JPG to SVG without any configuration using
ImageVectorizer. - Photo and Image Vectorization – Vectorize photos and raster images with customizable path tracing and color constraints.
- Advanced Customization – Customize
PathBuilder,TraceSmoother,TraceSimplifier, line width, and color limits for precise SVG output. - Stencil Effects – Apply stencil effects during image raster-to-vector processing.
- Trace Adjustments – Compare different results by changing the
TraceSimplifierandTraceSmootherproperties. - Vectorize Text Elements – Convert text in SVG documents to vector paths by enabling
VectorizeTextinSVGSaveOptions.
- Create a C# project and add the Aspose.SVG for .NET package via NuGet.
- Find the gist that corresponds to your specific task. Copy or download this gist to your local machine.
- Open the example and replace
DataDirandOutputDirwith the actual file paths. - Run the example to vectorize an image or text and check the results.
You can download a free trial of Aspose.HTML for .NET and use a temporary license for unrestricted access.
- High quality results: Convert pixel-based images into scalable SVG files for high-resolution, device-independent use.
- Custom trace control: Change trace smoothing, simplification, and pathing for clean, optimized SVG output.
- Text as vectors: Convert text into smooth vector paths. It can be scaled with saving quality, and you can apply any SVG effects to it.
Aspose.SVG for .NET is a powerful API designed for working with SVG files in C# applications. This cross-platform API allows developers to create, load, edit, render, convert, and merge SVG files. Additionally, in the area of image and text vectorization, the library offers tools to convert raster images (such as PNG, JPEG, BMP, etc.) into scalable SVG graphics and to transform text into vector paths for precise rendering.
- .NET Platforms: .NET Framework 4.6.1+, .NET Core 2.0+, or .NET 5.
- Supported OS: Windows, Linux, macOS.
- Development environment such as Visual Studio.
- Aspose.SVG for .NET installed via NuGet.