initial
This commit is contained in:
26
.devcontainer/devcontainer.json
Executable file
26
.devcontainer/devcontainer.json
Executable file
@@ -0,0 +1,26 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
|
||||
{
|
||||
"name": "Existing Dockerfile",
|
||||
"build": {
|
||||
// Sets the run context to one level up instead of the .devcontainer folder.
|
||||
"context": "..",
|
||||
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
|
||||
"dockerfile": "../Dockerfile"
|
||||
}
|
||||
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
// "features": {},
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
|
||||
// Uncomment the next line to run commands after the container is created.
|
||||
// "postCreateCommand": "cat /etc/os-release",
|
||||
|
||||
// Configure tool-specific properties.
|
||||
// "customizations": {},
|
||||
|
||||
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
|
||||
// "remoteUser": "devcontainer"
|
||||
}
|
||||
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
*.jpg
|
||||
*.png
|
||||
*_optimized.svg
|
||||
*.pyc
|
||||
16
.vscode/launch.json
vendored
Normal file
16
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Python Debugger: Current File with Arguments",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"program": "${file}",
|
||||
"console": "integratedTerminal",
|
||||
"args": ["3T_logo_master.svg", "configs/3t_full.json", "dbgout"]
|
||||
}
|
||||
]
|
||||
}
|
||||
327
3T_logo_master.svg
Normal file
327
3T_logo_master.svg
Normal file
@@ -0,0 +1,327 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
aria-labelledby="title desc"
|
||||
fill-rule="evenodd"
|
||||
height="1.9805982in"
|
||||
preserveAspectRatio="none"
|
||||
stroke-linecap="round"
|
||||
viewBox="0 0 7319.6557 1980.5982"
|
||||
width="7.3196559in"
|
||||
version="1.1"
|
||||
id="svg21"
|
||||
sodipodi:docname="3T_logo_master.svg"
|
||||
inkscape:version="1.4.3 (0d15f75, 2025-12-25)"
|
||||
inkscape:export-filename="3T_logo_compact_v2.svg"
|
||||
inkscape:export-xdpi="44.329895"
|
||||
inkscape:export-ydpi="44.329895"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<defs
|
||||
id="defs21" />
|
||||
<sodipodi:namedview
|
||||
id="namedview21"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#eeeeee"
|
||||
borderopacity="1"
|
||||
inkscape:showpageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#505050"
|
||||
inkscape:document-units="in"
|
||||
inkscape:zoom="1.4142136"
|
||||
inkscape:cx="112.78353"
|
||||
inkscape:cy="-70.357123"
|
||||
inkscape:window-width="3440"
|
||||
inkscape:window-height="1369"
|
||||
inkscape:window-x="1912"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="g21"
|
||||
showguides="true">
|
||||
<inkscape:page
|
||||
x="0"
|
||||
y="4.9061844e-23"
|
||||
width="7319.6558"
|
||||
height="1980.5983"
|
||||
id="page2"
|
||||
margin="0"
|
||||
bleed="0" />
|
||||
</sodipodi:namedview>
|
||||
<title
|
||||
id="title1">3t.network logo</title>
|
||||
<style
|
||||
type="text/css"
|
||||
id="style1">
|
||||
.green3t { fill:#97d8b2; }
|
||||
.brush1 { fill: none; }
|
||||
.pen1 { stroke: none; }
|
||||
.purple3t { fill:#ad96dc; }
|
||||
.black3t { fill:#1e1014; }
|
||||
.white3t { fill:#dee2e3; }
|
||||
</style>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer3"
|
||||
inkscape:label="background"
|
||||
transform="translate(238.70346,-724.8222)"
|
||||
style="display:inline"
|
||||
sodipodi:insensitive="true">
|
||||
<rect
|
||||
class="purple3t"
|
||||
style="display:inline;fill-opacity:1;stroke-width:6.85789"
|
||||
id="rect1"
|
||||
width="3222.4917"
|
||||
height="1979.5305"
|
||||
x="-238.70346"
|
||||
y="725.89001"
|
||||
inkscape:label="medium_background"
|
||||
inkscape:export-filename="3T_logo_mid_v2.svg"
|
||||
inkscape:export-xdpi="44.329895"
|
||||
inkscape:export-ydpi="44.329895" />
|
||||
<rect
|
||||
class="purple3t"
|
||||
style="display:inline;fill-opacity:1;stroke-width:10.3357"
|
||||
id="full_background"
|
||||
width="7319.6479"
|
||||
height="1979.5305"
|
||||
x="-238.69536"
|
||||
y="724.8222" />
|
||||
</g>
|
||||
<g
|
||||
id="g21"
|
||||
transform="matrix(0.82960318,0,0,0.82960318,322.98915,125.0121)"
|
||||
inkscape:label="woman logo">
|
||||
<polygon
|
||||
class="pen1 purple3t"
|
||||
points="1864,539 1844,500 1823,462 1800,425 1774,389 1747,354 1719,321 1688,289 1656,258 1622,229 1587,201 1551,175 1513,151 1473,128 1433,106 1391,87 1348,69 1304,54 1259,40 1213,28 1166,18 1119,10 1070,5 1021,1 971,0 921,1 872,5 823,10 776,18 729,28 683,40 638,54 594,69 551,87 509,106 468,128 429,151 391,175 354,201 319,229 285,258 253,289 223,321 194,354 167,389 142,425 118,462 97,500 77,539 60,579 45,620 32,662 21,704 12,748 6,792 2,837 1,882 2,927 6,972 12,1016 21,1060 32,1102 45,1144 60,1185 77,1225 97,1264 118,1302 142,1339 167,1375 194,1410 223,1443 253,1475 285,1506 319,1535 354,1563 391,1589 429,1613 468,1636 509,1658 551,1677 594,1695 638,1710 683,1724 729,1736 776,1746 823,1754 872,1759 921,1763 971,1764 1021,1763 1070,1759 1119,1754 1166,1746 1213,1736 1259,1724 1304,1710 1348,1695 1391,1677 1433,1658 1473,1636 1513,1613 1551,1589 1587,1563 1622,1535 1656,1506 1688,1475 1719,1443 1747,1410 1774,1375 1800,1339 1823,1302 1844,1264 1864,1225 1881,1185 1896,1144 1909,1102 1920,1060 1929,1016 1935,972 1939,927 1940,882 1939,837 1935,792 1929,748 1920,704 1909,662 1896,620 1881,579 "
|
||||
id="polygon1"
|
||||
inkscape:label="background_purple"
|
||||
style="display:inline;fill-opacity:1"
|
||||
transform="matrix(1.1749448,0.00740194,0.28938978,1.2590811,-418.63398,-51.910043)"
|
||||
sodipodi:insensitive="true" />
|
||||
<polygon
|
||||
class="pen1 green3t"
|
||||
points="823,10 776,18 729,28 683,40 638,54 594,69 551,87 509,106 468,128 429,151 391,175 354,201 319,229 285,258 253,289 223,321 194,354 167,389 142,425 118,462 97,500 77,539 60,579 45,620 32,662 21,704 12,748 6,792 2,837 1,882 2,927 6,972 12,1016 21,1060 32,1102 45,1144 60,1185 77,1225 97,1264 118,1302 142,1339 167,1375 194,1410 223,1443 253,1475 285,1506 319,1535 354,1563 391,1589 429,1613 468,1636 509,1658 551,1677 594,1695 638,1710 683,1724 729,1736 776,1746 823,1754 872,1759 921,1763 971,1764 1021,1763 1070,1759 1119,1754 1166,1746 1213,1736 1259,1724 1304,1710 1348,1695 1391,1677 1433,1658 1473,1636 1513,1613 1551,1589 1587,1563 1622,1535 1656,1506 1688,1475 1719,1443 1747,1410 1774,1375 1800,1339 1823,1302 1844,1264 1864,1225 1881,1185 1896,1144 1909,1102 1920,1060 1929,1016 1935,972 1939,927 1940,882 1939,837 1935,792 1929,748 1920,704 1909,662 1896,620 1881,579 1864,539 1844,500 1823,462 1800,425 1774,389 1747,354 1719,321 1688,289 1656,258 1622,229 1587,201 1551,175 1513,151 1473,128 1433,106 1391,87 1348,69 1304,54 1259,40 1213,28 1166,18 1119,10 1070,5 1021,1 971,0 921,1 872,5 "
|
||||
id="polygon1-9"
|
||||
inkscape:label="background_green"
|
||||
style="display:inline;fill-opacity:1;stroke:none"
|
||||
transform="matrix(1.1749448,0.00740194,0.28938978,1.2590811,-418.6356,-51.861599)" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="1048,610 1044,605 1038,601 1032,598 1026,596 1019,595 1012,596 1006,598 1000,601 995,605 991,610 988,616 986,623 985,630 986,637 988,643 991,649 995,655 1000,659 1006,662 1012,664 1019,665 1026,664 1032,662 1038,659 1044,655 1048,649 1051,643 1053,637 1054,630 1053,623 1051,616 "
|
||||
id="polygon2"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="776,703 772,698 766,694 760,691 754,689 747,688 740,689 733,691 727,694 722,698 717,703 714,709 712,716 711,723 712,730 714,736 717,742 722,748 727,752 733,755 740,757 747,758 754,757 760,755 766,752 772,748 776,742 779,736 781,730 782,723 781,716 779,709 "
|
||||
id="polygon3"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="850,562 845,559 840,557 834,556 828,556 817,560 809,568 804,578 803,589 838,819 962,801 973,797 981,789 986,779 986,768 985,762 982,757 979,753 975,749 970,746 965,744 959,743 953,743 887,753 861,581 860,575 857,570 854,566 "
|
||||
id="polygon4"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="1257,715 1258,726 1263,736 1267,740 1272,744 1277,746 1283,747 1288,747 1294,746 1299,744 1304,741 1304,741 1308,738 1312,735 1316,733 1321,731 1325,730 1330,729 1334,728 1339,728 1345,728 1350,729 1356,730 1361,732 1366,735 1371,738 1375,741 1379,745 1387,755 1393,766 1397,778 1398,791 1397,804 1393,816 1388,826 1381,836 1372,843 1362,849 1351,853 1339,854 1332,853 1324,852 1317,849 1310,845 1305,843 1299,841 1293,841 1288,842 1282,843 1277,846 1273,850 1269,854 1265,865 1266,876 1270,887 1278,895 1278,895 1285,899 1293,902 1300,906 1308,908 1315,910 1323,912 1331,913 1339,913 1351,912 1362,911 1373,908 1383,904 1394,899 1403,894 1412,887 1421,879 1429,870 1436,860 1442,850 1448,839 1452,827 1455,815 1456,803 1457,791 1456,779 1455,767 1452,755 1448,744 1442,733 1436,722 1429,712 1421,703 1412,696 1403,689 1394,683 1383,678 1373,674 1362,671 1351,670 1339,669 1329,669 1320,671 1310,673 1301,676 1292,679 1283,684 1275,689 1267,695 1260,704 "
|
||||
id="polygon5"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="1431,596 1428,585 1420,576 1405,565 1389,555 1374,548 1359,542 1344,538 1330,535 1316,534 1303,533 1291,533 1281,534 1271,535 1263,537 1256,538 1250,539 1247,540 1245,541 1235,547 1229,556 1226,567 1227,579 1230,584 1233,589 1238,593 1243,595 1248,597 1254,598 1259,598 1265,596 1268,595 1276,594 1288,592 1304,592 1322,594 1341,599 1362,608 1383,622 1388,625 1393,627 1399,628 1405,628 1410,627 1415,625 1420,622 1424,618 1429,607 "
|
||||
id="polygon6"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="1274,406 1258,406 1243,407 1229,409 1216,411 1205,413 1196,416 1189,418 1184,419 1182,420 1172,426 1165,435 1162,446 1164,457 1166,462 1170,467 1174,471 1178,473 1184,475 1189,476 1195,476 1201,475 1201,475 1206,474 1217,471 1235,467 1257,465 1281,464 1307,467 1331,475 1354,489 1359,493 1365,495 1370,496 1376,496 1381,495 1387,493 1392,489 1396,485 1401,475 1402,464 1399,453 1391,444 1375,433 1359,424 1342,417 1325,412 1308,408 1291,406 "
|
||||
id="polygon7"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="1578,999 1588,1005 1594,1006 1599,1007 1605,1006 1610,1004 1615,1001 1619,998 1623,993 1625,988 1625,988 1627,985 1629,980 1632,975 1637,969 1641,964 1646,960 1651,957 1657,956 1662,960 1668,969 1675,981 1682,997 1677,1001 1674,1007 1672,1013 1671,1020 1671,1024 1669,1029 1665,1035 1659,1041 1653,1044 1646,1046 1639,1047 1630,1047 1620,1046 1610,1045 1599,1042 1587,1039 1572,1033 1558,1026 1546,1019 1535,1010 1526,1001 1518,991 1511,981 1506,969 1500,948 1498,925 1500,899 1505,871 1514,841 1526,809 1542,776 1561,741 1578,706 1591,670 1600,632 1604,594 1604,556 1601,517 1594,478 1584,440 1570,403 1554,366 1535,332 1514,299 1490,268 1465,239 1438,213 1409,190 1386,174 1359,159 1329,143 1296,129 1261,115 1223,103 1183,93 1142,84 1099,78 1055,75 1010,74 964,77 918,83 872,92 826,107 780,125 763,134 746,147 730,163 715,181 702,202 691,225 683,249 678,275 677,295 679,314 684,332 691,350 700,366 712,382 726,396 742,409 757,419 773,429 789,437 805,444 822,450 840,455 858,459 876,462 895,464 914,464 934,464 954,463 975,460 997,457 1019,452 1041,447 1067,438 1091,424 1111,407 1128,387 1141,365 1149,341 1153,316 1151,291 1149,281 1145,271 1141,260 1135,251 1129,241 1121,233 1112,224 1101,217 1089,210 1076,204 1062,199 1046,195 1029,192 1010,191 990,191 968,192 922,198 887,208 860,219 841,232 829,246 821,259 818,272 818,284 823,301 832,317 846,331 863,343 884,353 906,360 931,364 956,364 956,364 967,360 976,353 981,343 982,332 981,326 979,321 976,316 972,312 968,309 962,307 957,305 951,305 936,305 922,304 910,301 899,297 890,292 884,287 879,283 877,279 879,277 882,274 888,271 897,266 909,262 926,258 947,254 973,251 998,250 1020,251 1040,254 1057,259 1071,267 1082,276 1090,288 1094,301 1095,314 1093,327 1088,341 1081,353 1071,366 1058,376 1043,385 1026,391 1007,396 988,399 970,402 952,404 935,406 919,406 902,406 887,404 872,402 857,399 842,395 828,390 815,384 801,378 789,370 776,362 766,354 757,345 749,336 744,326 739,316 737,305 736,293 736,281 739,264 745,248 752,232 761,217 771,204 782,193 793,184 804,178 847,161 890,148 933,139 977,134 1019,132 1061,134 1102,138 1142,144 1180,153 1216,163 1249,174 1281,186 1309,199 1335,212 1357,225 1375,237 1400,257 1423,280 1446,305 1466,332 1484,361 1501,391 1515,423 1527,455 1536,488 1542,521 1545,555 1545,588 1542,621 1535,652 1524,683 1510,712 1493,743 1477,776 1463,811 1451,847 1443,883 1440,920 1442,956 1451,990 1459,1007 1468,1024 1480,1038 1494,1052 1509,1064 1527,1075 1546,1085 1567,1093 1588,1099 1607,1103 1624,1105 1639,1105 1653,1104 1665,1101 1675,1097 1684,1093 1681,1102 1678,1112 1675,1122 1670,1132 1665,1142 1659,1153 1652,1164 1645,1175 1639,1183 1632,1190 1624,1198 1616,1206 1606,1213 1596,1220 1585,1227 1573,1233 1561,1239 1548,1245 1535,1250 1521,1254 1506,1257 1491,1260 1475,1262 1459,1263 1448,1266 1439,1273 1434,1283 1432,1294 1433,1300 1434,1305 1437,1310 1441,1314 1445,1317 1451,1320 1456,1321 1462,1322 1483,1320 1503,1318 1522,1314 1541,1309 1558,1303 1575,1297 1591,1290 1606,1282 1620,1274 1633,1265 1645,1256 1657,1247 1667,1237 1676,1228 1685,1218 1692,1209 1719,1165 1736,1124 1746,1086 1749,1051 1747,1020 1742,995 1737,975 1731,961 1724,948 1717,936 1709,925 1701,916 1692,909 1683,903 1674,899 1665,897 1647,897 1630,902 1616,910 1603,920 1592,931 1583,944 1576,956 1571,967 1569,978 1572,989 "
|
||||
id="polygon8"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="1669,1523 1692,1560 1711,1598 1726,1634 1738,1670 1746,1703 1753,1733 1757,1761 1759,1784 1760,1804 625,1804 627,1781 629,1754 633,1724 638,1693 645,1661 654,1630 665,1601 679,1576 683,1566 683,1554 678,1544 670,1536 665,1533 660,1532 654,1531 649,1532 643,1533 638,1536 634,1540 630,1544 609,1584 593,1629 582,1676 574,1721 569,1763 567,1798 566,1822 566,1833 566,1862 1816,1862 1818,1835 1818,1829 1818,1814 1817,1792 1814,1762 1809,1726 1801,1685 1788,1641 1771,1594 1748,1545 1719,1495 1683,1445 1640,1397 1587,1352 1526,1309 1454,1271 1372,1239 1366,1238 1361,1238 1355,1239 1350,1241 1345,1244 1341,1248 1337,1253 1335,1258 1334,1269 1337,1280 1344,1289 1354,1295 1419,1320 1476,1348 1526,1379 1571,1413 1609,1448 1642,1485 "
|
||||
id="polygon9"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="164,1021 153,1040 146,1052 140,1064 134,1077 129,1091 128,1103 131,1114 138,1122 149,1128 155,1129 160,1129 166,1127 171,1125 176,1122 180,1118 183,1113 185,1107 189,1098 193,1088 198,1078 204,1068 210,1057 216,1045 222,1033 227,1020 231,1006 233,991 233,975 230,959 229,956 223,943 216,931 208,921 198,911 189,902 179,894 168,886 158,879 151,874 144,869 138,864 132,859 126,854 121,849 117,844 113,839 110,830 109,822 109,814 112,806 115,798 120,789 126,780 134,769 144,755 154,740 164,723 172,704 179,683 182,659 183,633 179,604 179,604 177,598 175,593 171,589 167,585 162,583 157,581 151,580 145,581 134,585 126,593 122,603 122,615 125,635 125,653 122,670 118,684 112,698 104,710 96,722 87,734 78,746 70,759 62,774 56,789 51,805 50,823 53,842 60,863 62,866 68,875 74,884 81,892 89,899 98,906 106,913 115,920 124,926 132,932 140,938 147,944 154,950 160,956 166,962 170,968 174,975 175,990 171,1005 "
|
||||
id="polygon10"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="310,1021 300,1040 293,1052 287,1064 281,1077 276,1091 275,1103 278,1114 285,1122 296,1128 302,1129 307,1129 313,1127 318,1125 322,1122 326,1118 330,1113 332,1107 332,1107 335,1098 340,1088 345,1078 351,1068 357,1057 363,1045 369,1033 374,1020 378,1006 380,991 380,975 377,959 376,956 370,943 363,931 354,921 345,911 335,902 325,894 314,886 304,879 297,874 291,869 285,864 279,859 273,854 268,849 264,844 260,839 257,830 256,822 256,814 258,806 262,798 267,789 273,780 281,769 291,755 301,740 311,723 319,704 326,683 329,659 330,633 326,604 324,598 322,593 318,589 314,585 309,583 304,581 298,580 292,581 281,585 273,593 269,603 269,615 271,635 271,653 268,670 264,684 258,698 251,710 243,722 234,734 225,746 217,759 209,774 203,789 198,805 197,823 200,842 207,863 208,866 214,875 221,884 228,892 236,899 244,906 253,913 261,920 270,926 278,932 286,938 293,944 300,950 306,956 312,962 316,968 320,975 321,990 317,1005 "
|
||||
id="polygon11"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="1306,1274 1124,1387 996,1289 1002,1159 1016,1159 1030,1158 1043,1157 1057,1155 1071,1152 1084,1149 1097,1146 1111,1142 1124,1137 1137,1132 1150,1127 1162,1121 1175,1114 1187,1107 1199,1100 1211,1092 1219,1083 1223,1073 1223,1061 1218,1051 1214,1047 1210,1044 1205,1041 1200,1040 1194,1039 1188,1040 1183,1041 1178,1044 1178,1044 1168,1051 1158,1057 1147,1063 1137,1068 1126,1073 1115,1078 1104,1082 1093,1086 1082,1089 1071,1092 1059,1094 1048,1096 1036,1098 1025,1099 1013,1100 1002,1100 988,1100 974,1099 961,1097 947,1095 934,1092 921,1088 908,1084 895,1079 883,1074 871,1068 859,1061 847,1054 836,1046 825,1037 814,1028 804,1018 779,990 757,958 737,924 721,887 709,848 700,807 694,764 692,720 694,673 699,629 708,587 719,549 734,514 752,483 773,456 796,434 804,425 807,414 806,403 801,393 797,389 792,385 786,383 781,382 775,382 770,383 765,385 760,388 731,415 706,447 685,483 667,523 653,567 642,615 636,666 634,720 636,770 643,818 653,865 668,909 686,951 708,991 734,1027 763,1059 773,1068 783,1077 793,1086 803,1094 814,1101 825,1108 836,1115 847,1121 859,1127 870,1132 882,1137 894,1141 906,1145 919,1149 931,1152 944,1154 937,1317 1121,1458 1366,1306 1350,904 1349,898 1347,893 1344,888 1341,884 1336,880 1331,878 1326,876 1320,876 1309,879 1300,885 1294,895 1292,906 "
|
||||
id="polygon12"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="797,1842 799,1847 803,1852 807,1856 811,1858 817,1860 822,1861 828,1861 834,1860 844,1854 851,1845 853,1834 852,1823 753,1534 536,1446 538,1360 763,1364 1144,1838 1148,1842 1153,1845 1159,1847 1164,1848 1170,1848 1176,1847 1181,1845 1186,1842 1193,1833 1196,1823 1195,1811 1190,1801 1166,1772 1167,1771 1169,1770 1170,1769 1171,1768 1171,1768 1413,1530 1420,1520 1422,1509 1420,1498 1414,1489 1409,1485 1404,1482 1399,1481 1393,1480 1387,1480 1382,1482 1377,1484 1372,1488 1130,1726 1130,1727 792,1306 481,1301 476,1485 707,1578 "
|
||||
id="polygon13"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="962,1267 956,1265 951,1263 945,1263 945,1263 925,1268 905,1277 884,1289 864,1303 846,1317 831,1330 819,1341 812,1348 812,1348 806,1358 804,1369 806,1380 812,1390 816,1394 822,1396 827,1398 833,1398 838,1398 844,1396 849,1394 853,1390 866,1378 879,1366 893,1355 906,1345 919,1336 931,1329 942,1324 950,1322 961,1318 970,1311 975,1301 977,1290 976,1284 973,1279 970,1274 966,1270 "
|
||||
id="polygon14"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="556,1360 561,1358 567,1356 571,1353 575,1349 578,1344 580,1339 581,1333 581,1333 582,1319 581,1305 580,1292 577,1280 573,1269 567,1259 561,1249 553,1240 539,1228 524,1219 509,1212 494,1208 481,1206 470,1204 462,1204 458,1204 458,1204 446,1207 437,1213 432,1223 430,1234 431,1240 432,1245 435,1250 439,1254 443,1258 449,1260 454,1262 460,1262 464,1262 470,1263 476,1264 483,1265 491,1268 498,1271 505,1275 511,1280 517,1289 522,1300 523,1313 523,1328 525,1340 530,1350 539,1357 550,1360 "
|
||||
id="polygon15"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="538,1445 533,1435 525,1427 520,1424 514,1423 508,1422 503,1423 497,1425 493,1427 488,1431 485,1436 485,1436 480,1443 476,1449 471,1454 466,1458 462,1461 457,1464 452,1466 447,1467 440,1467 434,1467 427,1465 421,1462 416,1460 411,1457 408,1454 405,1452 405,1452 400,1448 395,1446 389,1445 384,1444 378,1445 373,1447 368,1450 364,1454 358,1464 356,1475 358,1486 365,1495 368,1498 374,1502 382,1508 393,1514 406,1519 420,1523 437,1526 454,1525 466,1523 477,1519 488,1514 498,1507 508,1499 517,1490 526,1479 534,1467 538,1456 "
|
||||
id="polygon16"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="22,1313 31,1320 42,1322 433,1322 444,1320 454,1313 460,1304 462,1293 460,1281 454,1272 444,1265 433,1263 42,1263 31,1265 22,1272 15,1281 13,1293 15,1304 "
|
||||
id="polygon17"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="51,1480 55,1487 60,1494 64,1501 69,1508 124,1485 118,1477 112,1468 106,1460 101,1451 36,1450 39,1458 43,1465 47,1473 "
|
||||
id="polygon18"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="1008,859 1003,858 999,858 995,858 991,858 989,910 991,910 992,910 994,910 996,910 1025,861 1021,860 1016,860 1012,859 "
|
||||
id="polygon20"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="76,1392 69,1370 64,1347 61,1324 59,1300 58,1276 58,1265 59,1253 60,1241 61,1230 405,1230 406,1241 407,1253 408,1265 408,1276 407,1303 404,1330 400,1355 394,1380 387,1403 378,1425 368,1446 357,1465 344,1482 331,1498 316,1511 301,1523 285,1532 268,1539 251,1543 233,1544 220,1543 208,1541 196,1538 184,1533 172,1527 160,1519 149,1510 138,1500 134,1496 131,1492 128,1489 124,1485 69,1508 75,1517 82,1525 90,1534 97,1542 112,1556 128,1568 145,1578 162,1587 179,1593 197,1598 215,1601 233,1602 251,1601 269,1598 287,1593 304,1587 321,1578 338,1568 354,1556 369,1542 391,1517 410,1489 426,1459 440,1425 451,1390 459,1353 464,1315 466,1276 466,1256 464,1236 462,1216 459,1196 455,1172 11,1172 7,1196 4,1216 2,1236 0,1256 0,1276 1,1299 2,1322 5,1345 9,1367 15,1389 21,1410 28,1430 36,1450 101,1451 91,1432 83,1413 "
|
||||
id="polygon19"
|
||||
style="fill-opacity:1" />
|
||||
<polygon
|
||||
class="pen1 black3t "
|
||||
points="1023,927 1015,933 1007,937 999,939 991,940 982,941 973,940 964,938 954,935 943,932 932,927 936,924 941,921 947,918 953,915 961,913 969,912 979,911 989,910 991,858 958,861 932,868 910,879 894,891 883,903 875,914 871,922 869,926 862,945 880,956 901,968 921,977 940,984 959,989 976,991 993,991 1010,989 1025,984 1044,975 1059,963 1071,950 1080,936 1087,924 1092,914 1094,906 1095,903 1102,879 1078,872 1071,870 1064,868 1057,866 1050,865 1044,864 1037,863 1031,862 1025,861 996,910 1000,910 1004,910 1009,910 1014,911 1018,911 1023,912 1029,913 1034,914 1029,921 "
|
||||
id="polygon21"
|
||||
style="fill-opacity:1" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
inkscape:label="Angry eye brows"
|
||||
style="display:inline"
|
||||
sodipodi:insensitive="true"
|
||||
transform="translate(163.89561,63.53735)">
|
||||
<g
|
||||
id="g33"
|
||||
style="display:inline"
|
||||
inkscape:label="right_eyebrow">
|
||||
<rect
|
||||
class="black3t"
|
||||
style="fill-opacity:1;stroke-width:11.2803;stroke-dasharray:none;marker-end:url(#SemiCircleEmpty)"
|
||||
id="rect22"
|
||||
width="115.43"
|
||||
height="32.893581"
|
||||
x="153.686"
|
||||
y="1065.9554"
|
||||
transform="matrix(0.65719038,-0.75372462,0.75755137,0.65277555,0,0)" />
|
||||
<ellipse
|
||||
class="black3t"
|
||||
style="fill-opacity:1;stroke-width:11.7941;stroke-dasharray:none"
|
||||
id="path22-2-5"
|
||||
cx="996.40741"
|
||||
cy="504.27887"
|
||||
ry="16.251907"
|
||||
rx="16.574514" />
|
||||
<ellipse
|
||||
class="black3t"
|
||||
style="fill-opacity:1;stroke-width:11.7941;stroke-dasharray:none"
|
||||
id="path22-2-1"
|
||||
cx="817.237"
|
||||
cy="619.04028"
|
||||
ry="16.251907"
|
||||
rx="16.574514" />
|
||||
</g>
|
||||
<g
|
||||
id="g34"
|
||||
style="display:inline"
|
||||
inkscape:label="left_eyebrow">
|
||||
<rect
|
||||
class="black3t"
|
||||
style="fill-opacity:1;stroke-width:11.1041;stroke-dasharray:none;marker-end:url(#SemiCircleEmpty-0)"
|
||||
id="rect22-8"
|
||||
width="112.23127"
|
||||
height="32.781921"
|
||||
x="897.92242"
|
||||
y="125.98831"
|
||||
transform="matrix(0.87320445,0.48735407,-0.45377712,0.89111521,0,0)" />
|
||||
<ellipse
|
||||
class="black3t"
|
||||
style="fill-opacity:1;stroke-width:11.7941;stroke-dasharray:none"
|
||||
id="path22-2"
|
||||
cx="921.68134"
|
||||
cy="589.94476"
|
||||
ry="16.251907"
|
||||
rx="16.574514" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
id="g2"
|
||||
inkscape:label="3t"
|
||||
transform="translate(155.37012,35.594428)"
|
||||
style="display:inline">
|
||||
<ellipse
|
||||
class="white3t"
|
||||
style="fill-opacity:1;stroke-width:12.054"
|
||||
id="path2"
|
||||
cx="2541.2942"
|
||||
cy="1435.5626"
|
||||
rx="710.97974"
|
||||
ry="721.38434"
|
||||
transform="matrix(0.82960318,0,0,0.82960318,167.61903,89.417659)"
|
||||
inkscape:label="3t_background" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
class="black3t"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:888.889px;font-family:Tienne;-inkscape-font-specification:Tienne;writing-mode:lr-tb;direction:ltr;display:inline;stroke-width:10"
|
||||
x="1797.5288"
|
||||
y="1627.064"
|
||||
id="text1"
|
||||
inkscape:label="3t"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1"
|
||||
style="font-size:888.889px;stroke-width:10"
|
||||
x="1797.5288"
|
||||
y="1627.064">3t</tspan></text>
|
||||
</g>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
class="white3t"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:888.889px;font-family:Tienne;-inkscape-font-specification:Tienne;writing-mode:lr-tb;direction:ltr;display:inline;fill-opacity:1;stroke-width:10"
|
||||
x="2975.0505"
|
||||
y="1652.5947"
|
||||
id="text2"
|
||||
sodipodi:insensitive="true"
|
||||
inkscape:label=".network"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2"
|
||||
style="stroke-width:10"
|
||||
x="2975.0505"
|
||||
y="1652.5947">.network</tspan></text>
|
||||
<metadata
|
||||
id="metadata2">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:title>3t.network logo</dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 24 KiB |
17
Dockerfile
Executable file
17
Dockerfile
Executable file
@@ -0,0 +1,17 @@
|
||||
FROM python
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt /app/
|
||||
|
||||
# Install Python packages
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy the script
|
||||
COPY svg_processor.py /app/
|
||||
|
||||
# TODO, actually make this do the generation
|
||||
|
||||
# Default command (can be overridden)
|
||||
CMD ["python", "svg_processor.py"]
|
||||
46
README.md
Executable file
46
README.md
Executable file
@@ -0,0 +1,46 @@
|
||||
# SVG Processor
|
||||
|
||||
This Python script processes an SVG file by removing specified elements, embedding fonts, and exporting to multiple formats.
|
||||
|
||||
## Features
|
||||
|
||||
- Remove SVG elements based on IDs specified in a JSON file
|
||||
- Embed fonts from external files into the SVG as base64
|
||||
- Optimize the SVG using scour
|
||||
- Export to optimized SVG, PNG, JPEG, and thumbnail JPEG
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3.9+
|
||||
- Libraries: lxml, cairosvg, scour
|
||||
|
||||
## Docker Usage
|
||||
|
||||
Build the Docker image:
|
||||
|
||||
```bash
|
||||
docker build -t svg-processor .
|
||||
```
|
||||
|
||||
Run the container:
|
||||
|
||||
```bash
|
||||
docker run -v /path/to/input:/input -v /path/to/output:/output svg-processor python svg_processor.py /input/input.svg /input/config.json /output
|
||||
```
|
||||
|
||||
Replace `/path/to/input` and `/path/to/output` with actual paths.
|
||||
|
||||
## JSON Configuration Format
|
||||
|
||||
See `sample_config.json` for an example.
|
||||
|
||||
- `remove`: Array of element IDs to remove
|
||||
- `fonts`: Object mapping font-family names to font file paths
|
||||
- `size`: Override the size - useful when the size of the new image cannot be automatically calulated
|
||||
|
||||
## Output
|
||||
|
||||
- `optimized.svg`: Optimized SVG with embedded fonts
|
||||
- `output.png`: PNG version
|
||||
- `output.jpg`: JPEG version
|
||||
- `thumbnail.jpg`: Thumbnail JPEG (128x128 max)
|
||||
BIN
Tienne-Regular.ttf
Executable file
BIN
Tienne-Regular.ttf
Executable file
Binary file not shown.
7
configs/3t_angry.json
Normal file
7
configs/3t_angry.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"file_name":"3t_full_angry",
|
||||
"remove": [],
|
||||
"fonts": {
|
||||
"tienne": "Tienne-Regular.ttf"
|
||||
}
|
||||
}
|
||||
8
configs/3t_full.json
Executable file
8
configs/3t_full.json
Executable file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"file_name":"3t_full",
|
||||
"remove": [
|
||||
"Angry eye brows"],
|
||||
"fonts": {
|
||||
"tienne": "Tienne-Regular.ttf"
|
||||
}
|
||||
}
|
||||
19
configs/3t_logo_green.json
Normal file
19
configs/3t_logo_green.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"file_name": "3t_logo_green",
|
||||
"remove": [
|
||||
"Angry eye brows",
|
||||
".network",
|
||||
"background",
|
||||
"3t",
|
||||
"background_purple"
|
||||
],
|
||||
"fonts": {
|
||||
"tienne": "Tienne-Regular.ttf"
|
||||
},
|
||||
"size":{
|
||||
"vx":"165",
|
||||
"vy":"88",
|
||||
"x":"1936.4955",
|
||||
"y":"1842.5645"
|
||||
}
|
||||
}
|
||||
19
configs/3t_logo_purple.json
Normal file
19
configs/3t_logo_purple.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"file_name": "3t_logo_purple",
|
||||
"remove": [
|
||||
"Angry eye brows",
|
||||
".network",
|
||||
"background",
|
||||
"3t",
|
||||
"background_green"
|
||||
],
|
||||
"fonts": {
|
||||
"tienne": "Tienne-Regular.ttf"
|
||||
},
|
||||
"size":{
|
||||
"vx":"165",
|
||||
"vy":"88",
|
||||
"x":"1936.4955",
|
||||
"y":"1842.5645"
|
||||
}
|
||||
}
|
||||
11
configs/3t_mid.json
Executable file
11
configs/3t_mid.json
Executable file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"file_name": "3t_mid",
|
||||
"remove": [
|
||||
"Angry eye brows",
|
||||
".network",
|
||||
"full_background"
|
||||
],
|
||||
"fonts": {
|
||||
"tienne": "Tienne-Regular.ttf"
|
||||
}
|
||||
}
|
||||
3
requirements.txt
Executable file
3
requirements.txt
Executable file
@@ -0,0 +1,3 @@
|
||||
lxml
|
||||
cairosvg
|
||||
scour
|
||||
212
svg_processor.py
Executable file
212
svg_processor.py
Executable file
@@ -0,0 +1,212 @@
|
||||
import argparse
|
||||
import json
|
||||
import base64
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import shutil
|
||||
from lxml import etree
|
||||
import cairosvg
|
||||
import scour.scour
|
||||
from PIL import Image
|
||||
|
||||
def convert_to_pixels(value, dpi=96):
|
||||
"""Convert SVG length values to pixels"""
|
||||
if value is None:
|
||||
return 0
|
||||
|
||||
value = str(value).strip()
|
||||
|
||||
# Handle different units
|
||||
match = re.match(r'^([\d.]+)(in|cm|mm|pt|px)?$', value)
|
||||
if not match:
|
||||
return float(value) if value else 0
|
||||
|
||||
num, unit = match.groups()
|
||||
num = float(num)
|
||||
|
||||
if unit == 'in':
|
||||
return num * dpi
|
||||
elif unit == 'cm':
|
||||
return num * dpi / 2.54
|
||||
elif unit == 'mm':
|
||||
return num * dpi / 25.4
|
||||
elif unit == 'pt':
|
||||
return num * dpi / 72
|
||||
else: # px or no unit
|
||||
return num
|
||||
|
||||
def get_bounding_box(svg_tree):
|
||||
"""Calculate bounds of all visible elements"""
|
||||
max_x = float('-inf')
|
||||
max_y = float('-inf')
|
||||
|
||||
for element in svg_tree.xpath("//*"):
|
||||
# Skip non-visual elements
|
||||
tag_name = etree.QName(element).localname
|
||||
if tag_name in ('defs', 'style', 'metadata', "svg", "page"):
|
||||
continue
|
||||
|
||||
# Get position/size attributes - simplified approach
|
||||
x = float(element.get('x', 0))
|
||||
y = float(element.get('y', 0))
|
||||
# need to detect transform in parent
|
||||
transformx = 0
|
||||
transformy = 0
|
||||
parent = element.getparent()
|
||||
transform_parent = parent.get('transform', "")
|
||||
|
||||
if transform_parent and "translate" in transform_parent:
|
||||
t = transform_parent.removeprefix("translate").replace("(","").replace(")","")
|
||||
transformx_str, transformy_str = transform_parent.removeprefix("translate").replace("(","").replace(")","").split(",")
|
||||
transformx = float(transformx_str)
|
||||
transformy = float(transformy_str)
|
||||
|
||||
transform_element = element.get('transform', "")
|
||||
if transform_element and "translate" in transform_element:
|
||||
transformx_str, transformy_str = transform_element.removeprefix("translate").replace("(","").replace(")","").split(",")
|
||||
transformx = transformx + float(transformx_str)
|
||||
transformy = transformy + float(transformy_str)
|
||||
|
||||
width = float(convert_to_pixels(element.get('width', 0)))
|
||||
height = float(convert_to_pixels(element.get('height', 0)))
|
||||
|
||||
x = x + transformx
|
||||
y = y + transformy
|
||||
|
||||
|
||||
max_x = max(max_x, x + width)
|
||||
max_y = max(max_y, y + height)
|
||||
|
||||
if max_x == float('inf'): # no elements found
|
||||
return 100, 100
|
||||
|
||||
return max_x , max_y
|
||||
|
||||
def update_size(svg_tree, size_dict):
|
||||
max_x = 0
|
||||
max_y = 0
|
||||
vx = 0
|
||||
vy = 0
|
||||
if size_dict:
|
||||
max_x = size_dict.get("x",0)
|
||||
max_y = size_dict.get("y",0)
|
||||
vx = size_dict.get("vx",0)
|
||||
vy = size_dict.get("vy",0)
|
||||
|
||||
if max_x ==0 or max_y == 0:
|
||||
max_x , max_y = get_bounding_box(svg_tree)
|
||||
|
||||
svg_root = svg_tree.getroot()
|
||||
svg_root.set('viewBox', f"{vx} {vy} {max_x} {max_y}")
|
||||
svg_root.set('width', f"{max_x}")
|
||||
svg_root.set('height', f"{max_y}")
|
||||
|
||||
|
||||
def remove_elements(svg_tree, remove_ids):
|
||||
"""Remove elements with specified IDs from the SVG tree."""
|
||||
namespaces = {
|
||||
'inkscape': 'http://www.inkscape.org/namespaces/inkscape'
|
||||
}
|
||||
for element_id in remove_ids:
|
||||
element = svg_tree.find(f".//*[@id='{element_id}']")
|
||||
if element is not None:
|
||||
element.getparent().remove(element)
|
||||
|
||||
element = svg_tree.find(f".//*[@inkscape:label='{element_id}']", namespaces=namespaces)
|
||||
if element is not None:
|
||||
element.getparent().remove(element)
|
||||
|
||||
|
||||
def embed_fonts(svg_tree, fonts_dict):
|
||||
"""Embed fonts specified in fonts_dict into the SVG."""
|
||||
defs = svg_tree.find(".//{http://www.w3.org/2000/svg}defs")
|
||||
if defs is None:
|
||||
defs = etree.SubElement(svg_tree.getroot(), "{http://www.w3.org/2000/svg}defs")
|
||||
|
||||
style = etree.SubElement(defs, "{http://www.w3.org/2000/svg}style")
|
||||
style.text = ""
|
||||
|
||||
for font_family, font_path in fonts_dict.items():
|
||||
if os.path.exists(font_path):
|
||||
with open(font_path, 'rb') as f:
|
||||
font_data = base64.b64encode(f.read()).decode('utf-8')
|
||||
mime_type = "font/ttf" # Assume TTF, adjust if needed
|
||||
data_url = f"data:{mime_type};base64,{font_data}"
|
||||
style.text += f"@font-face {{ font-family: '{font_family}'; src: url('{data_url}'); }}\n"
|
||||
|
||||
if not os.path.exists(f"/usr/local/share/fonts/{Path(font_path).name}"):
|
||||
shutil.copy2(font_path, "/usr/local/share/fonts",)
|
||||
|
||||
def optimize_svg(svg_tree):
|
||||
"""Optimize the SVG using scour."""
|
||||
svg_string = etree.tostring(svg_tree, encoding='unicode')
|
||||
options = scour.scour.sanitizeOptions()
|
||||
#options.enable_viewboxing = True
|
||||
options.enable_id_stripping = True
|
||||
options.enable_comment_stripping = True
|
||||
options.shorten_ids = True
|
||||
options.disable_style_to_xml = True
|
||||
options.indent_type = None
|
||||
optimized_svg = scour.scour.scourString(svg_string, options)
|
||||
return optimized_svg
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Process SVG file: remove elements, embed fonts, export optimized formats.")
|
||||
parser.add_argument("input_svg", help="Path to input SVG file")
|
||||
parser.add_argument("json_file", help="Path to JSON file with removal and font info")
|
||||
parser.add_argument("output_dir", help="Output directory for generated files")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Load JSON
|
||||
with open(args.json_file, 'r') as f:
|
||||
config = json.load(f)
|
||||
|
||||
remove_ids = config.get("remove", [])
|
||||
fonts_dict = config.get("fonts", {})
|
||||
size_dict = config.get("size", {})
|
||||
|
||||
# Parse SVG
|
||||
svg_tree = etree.parse(args.input_svg)
|
||||
|
||||
# Remove elements
|
||||
remove_elements(svg_tree, remove_ids)
|
||||
|
||||
# Embed fonts
|
||||
embed_fonts(svg_tree, fonts_dict)
|
||||
|
||||
update_size(svg_tree, size_dict)
|
||||
|
||||
# Optimize SVG
|
||||
optimized_svg = optimize_svg(svg_tree)
|
||||
|
||||
# Ensure output directory exists
|
||||
os.makedirs(args.output_dir, exist_ok=True)
|
||||
|
||||
prefix = ""
|
||||
if config.get("file_name"):
|
||||
prefix = f"{config.get('file_name')}_"
|
||||
|
||||
# Write optimized SVG
|
||||
svg_output = os.path.join(args.output_dir, f"{prefix}optimized.svg")
|
||||
with open(svg_output, 'w') as f:
|
||||
f.write(optimized_svg)
|
||||
|
||||
# Convert to PNG
|
||||
png_output = os.path.join(args.output_dir, f"{prefix}output.png")
|
||||
cairosvg.svg2png(bytestring=optimized_svg.encode('utf-8'), write_to=png_output, unsafe=True)
|
||||
|
||||
# Convert to JPEG
|
||||
jpeg_output = os.path.join(args.output_dir, f"{prefix}output.jpg")
|
||||
# Cairosvg doesn't directly support JPEG, so use the PNG to JPEG
|
||||
img = Image.open(jpeg_output.replace('.jpg', '.png'))
|
||||
img.convert("RGB").save(jpeg_output, 'JPEG')
|
||||
|
||||
# Create thumbnail JPEG
|
||||
thumbnail_output = os.path.join(args.output_dir, f"{prefix}thumbnail.jpg")
|
||||
img.thumbnail((128, 128)) # Example size, adjust as needed
|
||||
img.convert("RGB").save(thumbnail_output, 'JPEG')
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user