
//using XPrintServer.TestConsole;

//var runner = new StarVectorRunner("starvector.onnx");
//string svg = runner.GenerateSvg(@"J:\Dev\xprint\public\assets\image\firespace\originpic\test\222.png");
//File.WriteAllText(@"J:\Dev\xprint\public\assets\image\firespace\originpic\test\output.svg", svg);

using XPrint.Image;
using XPrintServer.TestConsole;



try
{
    string potracePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"SvgLibs/potrace.exe");
    string pngquantPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"SvgLibs/pngquant.exe");

    string inputSvgPath = "J:/111.png";
    string outputSvgPath = @"F:/output_auto_color.svg";
    // 创建位图转SVG转换器实例
    var converter = new ColorVectorConverter(potracePath, pngquantPath, false);

    // 转换图像（保留透明度，最多16种颜色）
    await converter.ConvertToSvg(inputSvgPath, outputSvgPath, 256, 1f, QuantizationAlgorithm.MedianCut, DitheringType.FloydSteinberg, true);

    Console.WriteLine($"转换成功！SVG文件已保存至: {Path.GetFullPath(outputSvgPath)}");
}
catch (Exception ex)
{
    Console.WriteLine($"错误: {ex.Message}");
    if (System.Diagnostics.Debugger.IsAttached)
    {
        Console.WriteLine("按任意键退出...");
        Console.ReadKey();
    }
}