scour-project / scour

Scour - An SVG Optimizer / Cleaner
Apache License 2.0
757 stars 61 forks source link

`--create groups` breaks file with `stroke-linejoin` #286

Open JoKalliauer opened 2 years ago

JoKalliauer commented 2 years ago

Input

in.svg

<?xml version="1.0" encoding="UTF-8"?>
<svg width="831.5" height="491.34" viewBox="0 0 613 365" xmlns="http://www.w3.org/2000/svg">
 <path d="m80 227c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" fill="#f00" stroke="#f00" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/>
 <path d="m80 227 60-62m0 0h60" fill="#f00" stroke="#f00" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"/>
 <path d="m210 165c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" fill="#f00" stroke="#f00" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/>
 <path d="m210 165 60-50m0 0h60" fill="#f00" stroke="#f00" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"/>
 <path d="m340 115c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" fill="#00f" stroke="#00f" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/>
 <path d="m340 115 60-25m0 0h100" fill="#00f" stroke="#00f" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"/>
 <path d="m510 90c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/>
 <path d="m340 115 60 25m0 0h100" stroke="#00f" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"/>
 <path d="m510 140c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/>
 <path d="m210 165 60 50m0 0h60" stroke="#f00" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"/>
 <path d="m340 215c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" fill="#00f" stroke="#00f" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/>
 <path d="m340 215 60-25m0 0h100" fill="#00f" stroke="#00f" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"/>
 <path d="m510 190c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/>
 <path d="m340 215 60 25m0 0h100" stroke="#00f" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"/>
 <path d="m510 240c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/>
 <path d="m80 227 60 63m0 0h60" stroke="#f00" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"/>
 <path d="m210 290c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/>
</svg>

Output

<?xml version="1.0" encoding="UTF-8"?>
<svg width="831.5" height="491.34" viewBox="0 0 613 365" xmlns="http://www.w3.org/2000/svg">
 <g fill="#f00" stroke="#f00" stroke-linecap="round" stroke-linejoin="round">
  <path d="m80 227c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" stroke-width="3"/>
  <path d="m80 227 60-62h60" stroke-width="4"/>
  <path d="m210 165c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" stroke-width="3"/>
  <path d="m210 165 60-50h60" stroke-width="4"/>
 </g>
 <g stroke-linecap="round" stroke-linejoin="round">
  <path d="m340 115c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" fill="#00f" stroke="#00f" stroke-width="3"/>
  <path d="m340 115 60-25h100" fill="#00f" stroke="#00f" stroke-width="4"/>
  <path d="m510 90c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" stroke="#000" stroke-width="3"/>
  <path d="m340 115 60 25h100" stroke="#00f" stroke-width="4"/>
  <path d="m510 140c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" stroke="#000" stroke-width="3"/>
  <path d="m210 165 60 50h60" stroke="#f00" stroke-width="4"/>
  <path d="m340 215c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" fill="#00f" stroke="#00f" stroke-width="3"/>
  <path d="m340 215 60-25h100" fill="#00f" stroke="#00f" stroke-width="4"/>
  <path d="m510 190c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" stroke="#000" stroke-width="3"/>
  <path d="m340 215 60 25h100" stroke="#00f" stroke-width="4"/>
  <path d="m510 240c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" stroke="#000" stroke-width="3"/>
  <path d="m80 227 60 63h60" stroke="#f00" stroke-width="4"/>
  <path d="m210 290c0 2.7614-2.2386 5-5 5s-5-2.2386-5-5 2.2386-5 5-5 5 2.2386 5 5z" stroke="#000" stroke-width="3"/>
 </g>
</svg>

out.svg

command

scour -i in.svg -o out.svg --create-groups

related Bugs

I did not find the issue at https://github.com/scour-project/scour/wiki/Documentation#--create-groups so I think this might be a new issue

copyright

source https://de.wikipedia.org/wiki/Datei:BaumNeu3.svg

author: https://de.wikipedia.org/wiki/Benutzer:STHD19

license: Public Domain