forked from wpilibsuite/branding
-
Notifications
You must be signed in to change notification settings - Fork 0
/
export.py
executable file
·77 lines (66 loc) · 1.59 KB
/
export.py
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
#!/usr/bin/env python3
import os
import subprocess
import sys
def main():
svgs = [f for f in os.listdir(".") if os.path.isfile(f) and f.endswith(".svg")]
# Export plain SVGs
os.makedirs(os.path.join("export", "svg"), exist_ok=True)
for svg in svgs:
print(f"Exporting {svg} to plain SVG export/svg/{svg}...", end="")
sys.stdout.flush()
subprocess.run(
[
"inkscape",
"--export-type=svg",
f"--export-filename=export/svg/{svg}",
"--export-text-to-path",
svg,
]
)
print(" done.")
# PNG icon rasterizations
subprocess.run(
[
"./rasterize.py",
"--svgs",
"export/svg/wpilib-icon.svg",
"--raster-extension",
"png",
"--raster-sizes",
"16",
"32",
"64",
"128",
"256",
"512",
"1024",
]
)
# PNG generic rasterizations
subprocess.run(
[
"./rasterize.py",
"--svgs",
"export/svg/wpilib-generic.svg",
"--raster-extension",
"png",
"--raster-sizes",
"75",
"128",
]
)
# ICO rasterizations
subprocess.run(
[
"./rasterize.py",
"--svgs",
"export/svg/wpilib-icon.svg",
"--raster-extension",
"ico",
"--raster-sizes",
"256",
]
)
if __name__ == "__main__":
main()