-
Notifications
You must be signed in to change notification settings - Fork 1
/
dCleaner4compression.sh
executable file
·74 lines (47 loc) · 5.57 KB
/
dCleaner4compression.sh
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
#!/bin/bash
for file in *.svg;do
# export file=min.svg
export fileN=$(echo $file | cut -f1 -d" ")
export tmp=$(echo $fileN | cut -f1 -d".")
export i=${tmp}c.svg
if [ -z ${meta+x} ]; then
meta=1 #if not specified kept meta to not make a copyright violation
fi
echo #Add a empty line to split the output
if [ $meta == 1 ]; then
export META=no
elif [ $meta == 0 ] ; then
echo delete Metadata
export META=yes
else
echo some error meta is $meta
fi
export INDENT=1
echo cleaner ${file} to $i begin, min=${minfilesize}, METAdelete=$META, INDENT=$INDENT
svgcleaner $file $i --allow-bigger-file --indent 1 --no-defaults --apply-transform-to-gradients no --apply-transform-to-shapes no --convert-shapes no --group-by-style no --join-arcto-flags no --join-style-attributes all --merge-gradients no --regroup-gradient-stops no --remove-comments no --remove-declarations no --remove-default-attributes no --remove-desc no --remove-dupl-cmd-in-paths no --remove-dupl-fegaussianblur no --remove-dupl-lineargradient no --remove-dupl-radialgradient no --remove-gradient-attributes no --remove-invalid-stops no --remove-invisible-elements no --remove-metadata $META --remove-needless-attributes no --remove-nonsvg-attributes no --remove-nonsvg-elements no --remove-text-attributes no --remove-title no --remove-unreferenced-ids no --remove-unresolved-classes no --remove-unused-coordinates no --remove-unused-defs no --remove-version no --remove-xmlns-xlink-attribute no --resolve-use no --simplify-transforms no --trim-colors no --trim-ids no --trim-paths no --ungroup-defs no --ungroup-groups no --use-implicit-cmds no --list-separator comma --paths-to-relative no --remove-unused-segments no --convert-segments no --coordinates-precision 2 --paths-coordinates-precision 4 --properties-precision 2 --transforms-precision 7 --apply-transform-to-paths no # --multipass # --copy-on-error #
#--properties-precision 2 # https://commons.wikimedia.org/wiki/File:Mn_coa_%C3%B6v%C3%B6rkhangai_aimag.svg
#--transforms-precision 7 # Philippines_orthographic_projection #--transforms-precision 4 # https://commons.wikimedia.org/wiki/File:Mn_coa_%C3%B6v%C3%B6rkhangai_aimag.svg
## outdated # --paths-coordinates-precision 3 # https://commons.wikimedia.org/wiki/File:Flag_of_Budapest_(1873-2011).svg
# --paths-coordinates-precision 4 https://commons.wikimedia.org/wiki/File:FlagOfYorkshire.svg
#--join-style-attributes all # https://github.com/RazrFalcon/svgcleaner/issues/182
#--remove-declarations no #valid-warning
#--remove-nonsvg-elements # removes flowtext https://github.com/RazrFalcon/svgcleaner/issues/126
#--remove-nonsvg-attributes no # https://github.com/RazrFalcon/svgcleaner/issues/141
#--remove-text-attributes no #keeps xml:space="preserve" for a workaround for https://github.com/scour-project/scour/issues/160
#--join-arcto-flags no # librsvgbug ?
#--remove-unused-segments no # https://github.com/RazrFalcon/svgcleaner/issues/146
# == old ==
#--paths-to-relative no # https://github.com/RazrFalcon/svgcleaner/issues/124 (solved)
# leads to --apply-transform-to-paths no
# and to --remove-unused-segments yes
# and to --convert-segments no
#echo mv ./${file} ./${tmp}4.xml
mv ./${file} ./${tmp}4.xml
#echo cleaner $i finish
done
DeactivateEverything=<<END
svgcleaner.exe min.svg output.svg --allow-bigger-file --indent 1 --apply-transform-to-gradients no --apply-transform-to-shapes no --convert-segments no --convert-shapes no --group-by-style no --join-arcto-flags no --join-style-attributes no --merge-gradients no --regroup-gradient-stops no --remove-comments no --remove-declarations no --remove-default-attributes no --remove-desc no --remove-dupl-cmd-in-paths no --remove-dupl-fegaussianblur no --remove-dupl-lineargradient no --remove-dupl-radialgradient no --remove-gradient-attributes no --remove-invalid-stops no --remove-invisible-elements no --remove-metadata no --remove-needless-attributes no --remove-nonsvg-attributes no --remove-nonsvg-elements no --remove-text-attributes no --remove-title no --remove-unreferenced-ids no --remove-unresolved-classes no --remove-unused-coordinates no --remove-unused-defs no --remove-unused-segments no --paths-to-relative no --remove-version no --remove-xmlns-xlink-attribute no --resolve-use no --simplify-transforms no --trim-colors no --trim-ids no --trim-paths no --ungroup-defs no --ungroup-groups no --use-implicit-cmds no --apply-transform-to-paths no # --copy-on-error
END
ActivateEverything=<<END
svgcleaner min.svg output.svg --allow-bigger-file --indent 1 --apply-transform-to-gradients yes --apply-transform-to-shapes yes --convert-shapes yes --group-by-style yes --join-arcto-flags yes --join-style-attributes all --merge-gradients yes --regroup-gradient-stops yes --remove-comments yes --remove-declarations yes --remove-default-attributes yes --remove-desc yes --remove-dupl-cmd-in-paths yes --remove-dupl-fegaussianblur yes --remove-dupl-lineargradient yes --remove-dupl-radialgradient yes --remove-gradient-attributes yes --remove-invalid-stops yes --remove-invisible-elements yes --remove-metadata yes --remove-needless-attributes yes --remove-nonsvg-attributes yes --remove-nonsvg-elements yes --remove-text-attributes yes --remove-title yes --remove-unreferenced-ids yes --remove-unresolved-classes yes --remove-unused-coordinates yes --remove-unused-defs yes --remove-version yes --remove-xmlns-xlink-attribute yes --resolve-use yes --simplify-transforms yes --trim-colors yes --trim-ids yes --trim-paths yes --ungroup-defs yes --ungroup-groups yes --use-implicit-cmds yes --list-separator comma --paths-to-relative yes --remove-unused-segments yes --convert-segments yes --apply-transform-to-paths yes
END