(ns cortex.video.magick4 (:import java.io.File) (:use clojure.java.shell)) (defn images [path] (sort (rest (file-seq (File. path))))) (def base "/home/r/proj/cortex/render/touch-cube/") (defn pics [file] (images (str base file))) (defn combine-images [] (let [main-view (pics "main-view") touch (pics "touch/0") background (repeat 9001 (File. (str base "background.png"))) targets (map #(File. (str base "out/" (format "%07d.png" %))) (range 0 (count main-view)))] (dorun (pmap (comp (fn [[background main-view touch target]] (println target) (sh "convert" touch "-resize" "x300" "-rotate" "180" background "-swap" "0,1" "-geometry" "+776+129" "-composite" main-view "-geometry" "+66+21" "-composite" target)) (fn [& args] (map #(.getCanonicalPath %) args))) background main-view touch targets))))