From 886751dd8d918b8fedc8e689b0b82653f0d11fc3 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 13 Jan 2020 12:55:52 -0500 Subject: [PATCH] Add Guile implementation of batch png->jpg conversion script. --- batch-convert.scm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 batch-convert.scm diff --git a/batch-convert.scm b/batch-convert.scm new file mode 100755 index 0000000..76710de --- /dev/null +++ b/batch-convert.scm @@ -0,0 +1,21 @@ +#!/usr/bin/env guile +!# + +;; Assumes that current directory is the root of the +;; programming_fundamentals repo. + +(use-modules (ice-9 ftw)) + +(define pngs + (scandir "image_batch" (lambda (f) (string-suffix? ".png" f)))) + +(define jpgs + (map (lambda (f) + (string-append (string-drop-right f 4) ".jpg")) + pngs)) + +(for-each (lambda (png jpg) + (system* "convert" + (string-append "image_batch/" png) + (string-append "image_batch/" jpg))) + pngs jpgs)