forked from toollabs/convert
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
134 lines (118 loc) · 11.6 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!DOCTYPE html>
<html>
<head>
<title>SVG2SVG</title>
<meta charset="UTF-8">
</head>
<body style="font-family:Liberation Sans,Arial,Helvetica,sans-serif;">
<!--
<h1>Convert PDF to SVG (<a href="https://tools.wmflabs.org/convert/">Rilkes convert tool</a>)</h1>
<form action="pdf2svg.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
<input type="file" name="file" id="file" accept="application/pdf" />
<input type="submit" name="submit" value="Convert to SVG" />
</form>
<h1>Convert SVG to PNG (<a href="https://tools.wmflabs.org/convert/">Rilkes convert tool</a>)</h1>
<form action="svg2png.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
<input type="file" name="file" id="file" accept="image/svg+xml" />
<input type="submit" name="submit" value="Convert to PNG" />
<br />
<input type="checkbox" name="no-antialiasing" value="1" id="no-antialiasing" /><label for="no-antialiasing"> disable <a href="//wikipedia.org/wiki/anti-aliasing">anti-aliasing</a> (experimental)</label>
</form>
-->
<h1>Repair SVGs and make Workarounds for librsvg</h1>
<form action="svg2svg.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="1597440" />
<input type="file" name="file" id="file" accept="image/svg+xml" />
<input type="submit" name="submit" value="Convert to SVG" />
<br />
<input type="checkbox" name="svgcleaner" value="1" id="svgcleaner" /><label for="svgcleaner"> run svgcleaner</label>
<br />
<input type="checkbox" name="scour" value="1" id="scour" /><label for="scour"> (currently not working) run scour and convert flowRoot to valid SVG1.1-text</label>
<br />
<input type="checkbox" name="svgo" value="1" id="svgo" /><label for="svgo"> (currently not working) run svgo</label>
<br />
<input type="checkbox" name="valid" value="1" id="valid" /><label for="valid"> (currently not working) make file valid (not recommended, always uses scour and svgcleaner)</label>
<br />
<input type="checkbox" name="santizise" value="1" id="santizise" /><label for="santizise"> sanitize potentially dangerous commands (if upload gets <a href="https://commons.wikimedia.org/wiki/Help:SVG#Blocked_Elements_and_Scripting">blocked</a>)</label>
<!--
<br />
<input type="checkbox" name="RunInkscape" value="1" id="RunInkscape" /><label for="RunInkscape"> convert flowRoot to text by Inkscape</label>
<br />
<input type="checkbox" name="svgo" value="1" id="svgo" /><label for="svgo"> run svgo (not implemented)</label>
<br />
<input type="checkbox" name="fallback" value="1" id="fallback" /><label for="fallback"> add fallback-fonts, replace fonts (not implemented)</label>
<br />
<input type="checkbox" name="extended" value="1" id="extended" /><label for="extended"> use extended version (not implemented)</label>
-->
</form>
<h2>Repairs the following bugs</h2>
<p><b>Function details:</b> Some Librsvg-Bugs should be repaired:
</p>
<ul><li><a href="https://phabricator.wikimedia.org/T68672" class="extiw" title="phab:T68672">phab:T68672</a> <code>sed -i "s/<style>/<style type=\"text\/css\">/"</code> (f.e. <a href="https://commons.wikimedia.org/wiki/File:Cityfone_logo.svg" title="File:Cityfone logo.svg">File:Cityfone_logo.svg</a>)</li>
<li><a href="https://phabricator.wikimedia.org/T32033" class="extiw" title="phab:T32033">phab:T32033</a> <code>sed -ri 's/stroke-dasharray=\"([[:digit:]\., ]*)([[:digit:]\.]+) ([[:digit:]\., ]+)\"/stroke-dasharray=\"\1\2,\3\"/g'</code> (f.e. <a href="https://commons.wikimedia.org/wiki/File:EKG-Reto_001.svg" title="File:EKG-Reto 001.svg">File:EKG-Reto_001.svg</a>)</li>
<li><a href="https://phabricator.wikimedia.org/T55899" class="extiw" title="phab:T55899">phab:T55899</a> <code>sed -ri "s/<mask([[:alnum:] =\"]*) maskUnits=\"userSpaceOnUse\"( id=\"[[:alnum:]_]+\"|)>/<mask\1\2>/g"</code> (f.e. <a href="https://commons.wikimedia.org/wiki/File:SVG_mask.svg" title="File:SVG mask.svg">File:SVG_mask.svg</a>)</li>
<li><a href="https://phabricator.wikimedia.org/T184369" class="extiw" title="phab:T184369">phab:T184369</a> <code>sed -ri "s/font-family=\"'([-[:alnum:] ]*)'(|,[-[:lower:]]+)\"/font-family=\'\1\'/g"</code> (f.e. <a href="https://commons.wikimedia.org/wiki/File:T184369.svg" title="File:T184369.svg">File:T184369.svg</a>)</li>
<li><a href="https://phabricator.wikimedia.org/T35245" class="extiw" title="phab:T35245">phab:T35245</a> one of the following:
<ul><li><code>sed -ri "s/<tspan([-[:alnum:]\.\"\#\ =]*) x=\"([-[:digit:]\.]+)( |,)([-[:digit:]\. ,]+)\"([-[:alnum:]\.\"\#\ =]*)>/<tspan x=\"\2\" \1 \5>/g"</code> (f.e. <a href="https://commons.wikimedia.org/wiki/File:WI_Area_Codes.svg" title="File:WI Area Codes.svg">File:WI_Area_Codes.svg</a>)</li>
<li><code>sed -ri "s/<tspan([-[:alnum:]\.\"\#\ =]*) x=\"([-[:digit:]\.]+)( |,)([-[:digit:]\. ,]+)\"([-[:alnum:]\.\"\#\ =]*)>([[:alnum:]])/<tspan x=\"\2\" \1 \5>\6<\/tspan><tspan x=\"\4\" \1 \5>/g"</code> (f.e. <a href="https://commons.wikimedia.org/wiki/File:Kalliauer_et_al_2018_Acta_Mechanica_Fig11.svg" title="File:Kalliauer et al 2018 Acta Mechanica Fig11.svg">File:Kalliauer_et_al_2018_Acta_Mechanica_Fig11.svg</a>)</li></ul></li>
<li><a href="https://phabricator.wikimedia.org/T193929" class="extiw" title="phab:T193929">phab:T193929</a> <code>sed -i "s/ xlink:href=\"data:image\/jpg;base64,/ xlink:href=\"data:image\/jpeg;base64,/g"</code> (f.e. <a href="https://commons.wikimedia.org/wiki/File:Barents_Sea_map_hr.svg" title="File:Barents Sea map hr.svg">File:Barents_Sea_map_hr.svg</a>)</li>
<li><a href="https://phabricator.wikimedia.org/T194192" class="extiw" title="phab:T194192">phab:T194192</a><code>sed -ri "s/<svg([-[:alnum:]=\" ]*) viewBox=\"0,0,([[:digit:]\.]*),([[:digit:]\.]*)\"/<svg\1 viewBox=\"0 0 \2 \3\"/g"</code> (f.e. <a href="https://commons.wikimedia.org/wiki/File:WikiImplementationBug_T194192.svg" title="File:WikiImplementationBug T194192.svg">File:WikiImplementationBug_T194192.svg</a>)</li>
<li>remove CDATA <code>sed -ri -e ':a' -e 'N' -e '$!ba' -e "s/<\!\[CDATA\[([[:alnum:]=+\/\t\n[:space:]@:;\(\)\"\,\'\{\}\-])*\t\]\]>[[:space:]]*//g"</code> (f.e. <a href="https://commons.wikimedia.org/wiki/File:Map-Awala_Yalimpo.svg" title="File:Map-Awala Yalimpo.svg">File:Map-Awala_Yalimpo.svg</a>)</li>
<li>remove jpeg in metadata <code>sed -ri -e ':a' -e 'N' -e '$!ba' -e "s/<xapGImg:image>([[:alnum:][:space:]\/+])*={0,2}[[:space:]]*<\/xapGImg:image>//g"</code> (f.e. <a href="https://commons.wikimedia.org/wiki/File:Harta_dialectului_lemosin.svg" title="File:Harta dialectului lemosin.svg">File:Harta_dialectului_lemosin.svg</a>)</li>
<li>add mimetype: <code>sed -i "s/ xlink:href=\"data:;base64,\/9j\/4AAQSkZJRgABAgAAZABkAAD\/7AARRHVja3kAAQAEAAAAHgAA/ xlink:href=\"data:image\/jpeg;base64,\/9j\/4AAQSkZJRgABAgAAZABkAAD\/7AARRHVja3kAAQAEAAAAHgAA/"</code> (f.e. <a href="https://commons.wikimedia.org/wiki/File:Asia.svg" title="File:Asia.svg">File:Asia.svg</a>) <code>sed -ri "s/ xlink:href=\"data:;base64,( |)iVBORw0KGgoAAAANSUhEUgAA/ xlink:href=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAA/"</code> (f.e. <a href="https://commons.wikimedia.org/wiki/File:Historical_map_of_Georgia_1267_BC.svg" title="File:Historical map of Georgia 1267 BC.svg">File:Historical_map_of_Georgia_1267_BC.svg</a>)</li>
<li>Replaced "href" with "xlink:href" (f.e. <a href="https://commons.wikimedia.org/wiki/File:Eliandthethirteenthconfession_logo.svg" title="File:Eliandthethirteenthconfession logo.svg">File:Eliandthethirteenthconfession_logo.svg</a> done by <a href="/w/index.php?title=User:TilmannR&action=edit&redlink=1" class="new" title="User:TilmannR (page does not exist)">User:TilmannR</a>)</li>
<li><a href="https://phabricator.wikimedia.org/T32033" class="extiw" title="phab:T32033">phab:T32033</a> <code>stroke-dasharray</code> in PNG thumbnails does not support spaces as separators</li>
<li><a href="https://phabricator.wikimedia.org/T35245" class="extiw" title="phab:T35245">phab:T35245</a> Multiple x-coordinates in text/tspan</li>
<li><a href="https://phabricator.wikimedia.org/T43424" class="extiw" title="phab:T43424">phab:T43424</a> <code>flowRoot</code> (defined only in deprecated SVG 1.2 draft) not supported by rsvg</li>
<li><a href="https://phabricator.wikimedia.org/T55899" class="extiw" title="phab:T55899">phab:T55899</a> SVG masks fail to render (or even display)</li>
<li><a href="https://phabricator.wikimedia.org/T68672" class="extiw" title="phab:T68672">phab:T68672</a> SVG style element ignored if no <code>type="text/css"</code> attribute is specified</li>
<li><a href="https://phabricator.wikimedia.org/T184369" class="extiw" title="phab:T184369">phab:T184369</a> <code>font-family="'font name'"</code> and <code>style="font-family:'font name'"</code> does not work in SVG rendering</li>
<li><a href="https://phabricator.wikimedia.org/T194192" class="extiw" title="phab:T194192">phab:T194192</a> <code>viewBox="0,0,620,472"</code> should be the same as <code>viewBox="0 0 620 472"</code></li>
<li><a href="https://phabricator.wikimedia.org/T217990" class="extiw" title="phab:T217990">phab:T217990</a> arc flags without space not recognized</li></ul>
----
<h1>Extract PNG from FakeSVG</h1>
<form action="fakesvg2png.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="1728180" /><!-- 1470464 -->
<input type="file" name="file" id="file" accept="image/svg+xml" />
<input type="submit" name="submit" value="Extract PNG" />
</form>
<!--
<br />
<input type="checkbox" name="nocompress" value="1" id="nocompress" /><label for="nocompress">do not compress image (for large files)</label>
<h1>Test Output=Input</h1>
<form action="keep.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
<input type="file" name="file" id="file" accept="image/svg+xml" />
<input type="submit" name="submit" value="Copy" />
</form>
-->
----
<h1>Web service restart</h1>
<p>If the Error "500 - Internal Server Error" occurs, the web service has to be restarted. You have to message JoKalliauer to fix it. (see below)</p>
<br /><br />
<h1>cantmove</h1>
This tool can only convert svgs till about 1MB. (I do not know how to fix this.)
PS: I don't even know why it redirects to <a href="https://svgworkaroundbot.toolforge.org/#cantmove">#cantmove</a>.
<!--
<h1>This tool can only convert svgs till 63kB. (Don't ask me why! Help needed!)</h1>
Exact limit seems to be 65 143 Bytes (including filename)
-->
<!--<h1>Currently the tool is under development 25.03.2019, and maybe does not work. The maintainer try to solve it.</h1>-->
<div style="height:100px;" class="od-spacer"></div>
<div style="color:white">
<div style="width:18%; border-bottom: 2px solid #396; float: left;"> </div>
<div style="width:18%; border-bottom: 2px solid #A7D7F9; float: left;"> </div>
<div style="width:18%; border-bottom: 2px solid #666; float: left;"> </div>
</div>
<div style="clear:left; margin-top: 0.3em">This tool is maintained by <a href="//commons.wikimedia.org/wiki/User:JoKalliauer">Johannes Kalliauer</a>.
The source-code is available <a href="https://github.com/JoKalliauer/cleanupSVG">On GitHub</a>
<br/>
This website is based on <a href="https://tools.wmflabs.org/convert/">https://tools.wmflabs.org/convert/</a> by <a href="//commons.wikimedia.org/wiki/User:Rillke">Rillke</a> and others, source: <a href="https://github.com/Rillke/convert">GitHub</a>.</div>
<br/><br/>
Contact:
<br/><a href="https://commons.wikimedia.org/wiki/User_talk:SVGWorkaroundBot">https://commons.wikimedia.org/wiki/User_talk:SVGWorkaroundBot</a>
<br/><a href="https://github.com/JoKalliauer/convert">https://github.com/JoKalliauer/convert</a>
</body>
</html>