Script for generating cover images
authorDan Scott <dscott@laurentian.ca>
Fri, 25 Aug 2017 19:15:28 +0000 (15:15 -0400)
committerDan Scott <dscott@laurentian.ca>
Fri, 25 Aug 2017 19:15:28 +0000 (15:15 -0400)
Signed-off-by: Dan Scott <dscott@laurentian.ca>
tools/generate_cover_images.py [new file with mode: 0755]

diff --git a/tools/generate_cover_images.py b/tools/generate_cover_images.py
new file mode 100755 (executable)
index 0000000..4535c36
--- /dev/null
@@ -0,0 +1,17 @@
+#!/usr/bin/env python3
+
+import glob
+import os
+import subprocess
+
+os.makedirs('./jacket/small/r/', exist_ok=True)
+os.makedirs('./jacket/medium/r/', exist_ok=True)
+os.makedirs('./jacket/large/r/', exist_ok=True)
+
+for img in glob.glob('*.jpg'):
+    img_base = img[0:img.find('.')]
+    print(img_base)
+    cnv = "convert -scale '{}%' {} jacket/{}/r/{}"
+    subprocess.run([cnv.format('7', img, 'small', img_base)], shell=True, check=True)
+    subprocess.run([cnv.format('15', img, 'medium', img_base)], shell=True, check=True)
+    subprocess.run([cnv.format('30', img, 'large', img_base)], shell=True, check=True)