python-refactor
LostQuasar 2 years ago
parent 0b7bac1a7a
commit d8c38cc0cd

@ -0,0 +1,2 @@
raster_images = true
raster_size = 512

@ -1,6 +1,6 @@
from svgutils.compose import *
from cairosvg import svg2png
import toml
import toml, os
CONFIG["svg.file_path"] = "../assets/"
@ -8,6 +8,11 @@ with open("../definitions.toml", "r") as def_file:
definitions = toml.loads(def_file.read())
with open("../designs.toml", "r") as design_file:
designs = toml.loads(design_file.read())
with open("../config.toml", "r") as config_file:
config = toml.loads(config_file.read())
os.makedirs("../output/vector/", exist_ok=True)
os.makedirs("../output/" + str(config["raster_size"]) + "/", exist_ok=True)
partsList = []
for key in designs:
@ -18,11 +23,12 @@ for key in designs:
svg_parts = []
for part in partsList:
svg_parts.append(SVG(part))
Figure(
"128",
"128",
*svg_parts,
SVG("credits.svg")
).save("../output/vector/"+key+".svg")
svg2png(url="../output/vector/"+key+".svg", write_to="../output/512/"+key+".png", output_width=512)
Figure("128","128", *svg_parts, SVG("credits.svg")).save("../output/vector/" + key + ".svg")
if config["raster_images"]:
svg2png(
url="../output/vector/" + key + ".svg",
write_to="../output/" + str(config["raster_size"]) + "/" + key + ".png", output_width=config["raster_size"]
)
print("Done!")
Loading…
Cancel
Save