From 7a4f9e14216d577bd5e4f79a0267580308acfdb9 Mon Sep 17 00:00:00 2001 From: haelyak Date: Thu, 2 Nov 2023 20:55:59 -0700 Subject: [PATCH] moved convert and color_convert python scripts to utilities --- utilities/color_convert | 17 +++++++++++++++++ utilities/convert | 9 +++++++++ 2 files changed, 26 insertions(+) create mode 100644 utilities/color_convert create mode 100755 utilities/convert diff --git a/utilities/color_convert b/utilities/color_convert new file mode 100644 index 0000000..0ed02a3 --- /dev/null +++ b/utilities/color_convert @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 + +import sys +import svgwrite +import xml.etree.ElementTree as ET + +file = sys.argv[1] # first command line argument +stroke_color = sys.argv[2] # second command line argument + +tree = ET.parse(file) # parses the svg xml +root = tree.getroot() + +for element in root.iter(): # goes through all the elements in the xml and switches the stroke color + if "stroke" in element.attrib: + element.attrib["stroke"] = stroke_color + +tree.write(file) # writes new xml out to file \ No newline at end of file diff --git a/utilities/convert b/utilities/convert new file mode 100755 index 0000000..785ee21 --- /dev/null +++ b/utilities/convert @@ -0,0 +1,9 @@ +#!/usr/bin/env python3 + +import pyembroidery +import sys + +if len(sys.argv) < 3: + sys.exit("Usage: {} ".format(sys.argv[0])) + +pyembroidery.write(pyembroidery.read(sys.argv[1]), sys.argv[2])