【问题标题】:Conversion of Image to XAML and improving the XAML Design Clarity将图像转换为 XAML 并提高 XAML 设计清晰度
【发布时间】:2014-01-31 21:02:00
【问题描述】:

我正在尝试将图像转换为 XAML 代码。为此,我使用“Potrace”和“SharpVectors”。 Potrace 会将图像转换为 SVG(标量矢量图形),SharpVectors 会将 SVG 文件作为输入并将 XAML 作为输出。转换正在发生,但转换后的 XAML 设计并不那么清晰。图像的清晰度已降低。有提高图像清晰度的想法吗?

Process p = new Process();
p.StartInfo.FileName = "Potrace.exe";
p.StartInfo.Arguments = "-s " +"test.bmp"+ " -o " + "test.svg"  ;
p.Start();
xamlcreator.Convert("test.svg");

xamlcreator 是一个从 SharpVectors dll 中使用的函数。

【问题讨论】:

  • 我认为问题是第一步。将位图转换为矢量图形。在这一点上,您几乎总是会失去“图像清晰度”
  • 我了解到 Inkscape 是用于将 Image 转换为 XAML 的工具。 Inkscape 使用相同的技术,即 Potrace 将图像转换为 XAML。但是,与我得到的输出相比,图像清晰度要好得多。甚至 Inkscape 也将图像转换为 SVG 文件。当 Inkscape 这样做时,清晰度很好。
  • 您是否尝试过探索 Potrace.exe 允许您设置的设置?你有没有用 / 调用它?或 --help ?
  • 是的@Samuel 我已经尝试了所有选项。

标签: c# wpf image xaml svg


【解决方案1】:

您没有使用缩放和放置选项:

 -P, --pagesize format      - page size (default is letter)
 -W, --width dim            - width of output image
 -H, --height dim           - height of output image
 -r, --resolution n[xn]     - resolution (in dpi) (dimension-based backends)
 -x, --scale n[xn]          - scaling factor (pixel-based backends)
 -S, --stretch n            - yresolution/xresolution
 -A, --rotate angle         - rotate counterclockwise by angle
 -M, --margin dim           - margin
 -L, --leftmargin dim       - left margin
 -R, --rightmargin dim      - right margin
 -T, --topmargin dim        - top margin
 -B, --bottommargin dim     - bottom margin

参考Potrace

【讨论】:

  • 我已经尝试了所有命令,但质量仍然很差。以上所有选项只会设置输出图像的位置。它不会提高图像的质量。我的猜测是“多次跟踪图像可以产生更好的输出”。我不确定,也不知道如何多次跟踪图像。
  • 多次跟踪可能意味着使用上一次运行的输出多次调用跟踪器。
  • 还有一种方法。即,无论输入如何,我获得的输出都是黑白的。所以跟踪只发生在 2 种颜色上。有什么方法可以通过两种以上的颜色进行追踪? Inkscape 工具在输入阶段获取要跟踪的颜色总数。所以我想这就是方法。关于如何做到这一点的任何想法?
  • 所以使用Potrace.exe -r 1000 不会产生比Potrace.exe -r 70 质量更好的图像?
  • 不,@Mashton 它没有提供更好的质量。只有图像的大小会增加和减少。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-04-27
  • 1970-01-01
  • 1970-01-01
  • 2011-04-16
相关资源
最近更新 更多