Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在SVG中合并相似的标记_C#_Svg - Fatal编程技术网

C# 在SVG中合并相似的标记

C# 在SVG中合并相似的标记,c#,svg,C#,Svg,我有一个SVG文件包含大约20000个路径,如下所示: <rect x="0" y="0" fill="#191915" width="1" height="1"/> <rect x="0" y="1" fill="#191915" width="1" height="1"/> <rect x="0" y="2" fill="#191915" width="1" height="1"/> <rect x="0" y="3" fill="#191915"

我有一个SVG文件包含大约20000个路径,如下所示:

<rect x="0" y="0" fill="#191915" width="1" height="1"/>
<rect x="0" y="1" fill="#191915" width="1" height="1"/>
<rect x="0" y="2" fill="#191915" width="1" height="1"/>
<rect x="0" y="3" fill="#191915" width="1" height="1"/>
<rect x="0" y="4" fill="#191915" width="1" height="1"/>
<rect x="0" y="5" fill="#191915" width="1" height="1"/>
<rect x="0" y="6" fill="#191915" width="1" height="1"/>
<rect x="0" y="7" fill="#FF00FF" width="1" height="1"/>
<rect x="0" y="8" fill="#191915" width="1" height="1"/>
<rect x="0" y="9" fill="#191915" width="1" height="1"/>
<rect x="0" y="10" fill="#191915" width="1" height="1"/>
<rect x="0" y="11" fill="#191915" width="1" height="1"/>
<rect x="0" y="12" fill="#191915" width="1" height="1"/>

等等

每个标记包含路径的位置、颜色填充及其宽度和高度(始终为1像素) 我需要一个工具来自动合并彼此连接的相似标记,使其成为一个标记,例如:

<polygon fill="#191915" points="0,0 0,1 0,2 0,3 0,4 0,5 0,6 1.6 1.5 1.4 1.3 1.2 1.1 1.0"\>
<rect x="0" y="6" fill="#FF00FF" width="1" height="1"/>
<polygon fill="#191915" points="0.8 0.9 0.10 0.11 0.12 1.12 1.11 1.10 1.9 1.8"\>


例如,尝试SVG Cleaner,不幸的是它没有工作