File talk:BSicon HANDCAR.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Simplifying SVG code[edit]

Old code
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--drawn by Richtest-->
 1 <svg xmlns="http://www.w3.org/2000/svg" width="500" height="500">
 2 <title>HANDCAR</title>
 3  <g style="stroke: rgb(0, 0, 0); fill: none; stroke-linecap: round;">
 4   <g style="stroke-width: 25px;">
 5    <circle cx="100" cy="425" r="60"/>
 6    <circle cx="400" cy="425" r="60"/>
 7   </g>
 8   <g style="stroke-width: 20px;">
 9    <path d="M 140,80 360,200"/>
10    <path d="M 170,70 110,90"/>
11    <path d="M 390,190 330,210"/>
12    <path d="M 250,140 310,300"/>
13    <path d="M 250,140 190,300"/>
14   </g>
15   <g style="stroke-width: 10px;">
16    <path d="m 235,180 h 30"/>
17     <path d="m 220,220 h 60"/>
18     <path d="m 205,260 h 90"/>
19   </g>
20  </g>
21  <g style="fill: rgb(0, 0, 0);">
22   <path d="M 150,300 h 200 v 20 H 490 v 50 H 10 v -50 H 150 z" style="fill: rgb(0, 0, 0);"/>
23   <circle cx="250" cy="140" r="15"/>
24  </g>
25 </svg>
New code
 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <svg xmlns="http://www.w3.org/2000/svg" width="500" height="500">
 3 <g style="stroke:#000;fill:none;stroke-linecap:round">
 4  <path stroke-width="25" d="M99,365a60,60 0 1,0 2,0M399,365a60,60 0 1,0 2,0"/>
 5  <path stroke-width="20" d="M140,80 360,200M170,70 110,90M330,210l60,-20M250,140 310,300M250,140 190,300"/>
 6  <path stroke-width="10" d="M235,180h30M220,220h60M205,260h90"/>
 7 </g>
 8 <path d="M150,300h200v20H490v50H10v-50H150zM249,125a15,15 0 1,0 2,0"/>
 9 </svg>

File size reduced from 874 bytes to 496 -> -43% New ideas welcome. -Richtest (talk) 01:16, 10 December 2011 (UTC)[reply]

Again 18 Bytes
 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <svg xmlns="http://www.w3.org/2000/svg" width="500" height="500">
 3 <g stroke="#000" fill="none" stroke-linecap="round">
 4 <path stroke-width="25" d="M99,365a60,60 0 1,0 2,0m298,0a60,60 0 1,0 2,0"/>
 5 <path stroke-width="20" d="M110,90l60-20m80,70l60,160M140,80 360,200m-30,10l60-20M190,300l60-160"/>
 6 <path stroke-width="10" d="M235,180h30m30,80h-90m15-40h60"/>
 7 </g>
 8 <path d="M150,300h200v20H490v50H10v-50H150zM249,125a15,15 0 1,0 2,0"/>
 9 </svg>

File size reduced from 874 bytes to 478 -> -45% (470 without 8 EOLs -> -46%) -Richtest (talk) 10:56, 10 December 2011 (UTC)[reply]