.NET Standard port of Potrace. In this port, I aim to keep the syntax and comments as close to the C version as possible. This will help with keeping up to date on any new Potrace versions. I only aim to use typical C# syntax in the public API.
Usage:
-
Install the NuGet package
-
Write some code:
// Create PotraceBitmap var width = 100; var height = 100; using var potraceBitmap = PotraceBitmap.Create(width, height); // Add black pixels potraceBitmap.SetBlackUnsafe(0, 0); potraceBitmap.SetBlackUnsafe(0, 1); // Create options var param = new PotraceParam(); // Trace using Potrace var traceResult = Potrace.Trace(param, potraceBitmap);
Note: Potrace images are only black and white. If you want to create one from a specific image, you could iterate over the source image's pixels and
SetBlackUnsafe
wherever you want the Potrace image pixel to be black.BitmapToVector
doesn't have features to determine which pixels "should" be black, so that part is up to you. -
Refer to Potrace's technical documentation for more information.
Builds off of BitmapToVector and adds support for SKPath
and SKBitmap
.
Usage:
-
Install the NuGet package
-
Install the SkiaSharp NuGet package
-
Use these additional methods:
IEnumerable<SKPath> skPathsFromSKBitmap = PotraceSkiaSharp.Trace(PotraceParam, SKBitmap); IEnumerable<SKPath> skPathsFromPotraceBitmap = PotraceSkiaSharp.Trace(PotraceParam, PotraceBitmap);
Note:
PotraceSkiaSharp.Trace
will treat all pixels with a red value less than 128 as "black".
Please note the GPL-3.0 license. This can have big implications if you decide to use this library.