]> git.netwichtig.de Git - snippets/henkpngscanproc.git/commitdiff
Initial commit master
authorHendrik Jaeger <git-commit@henk.geekmail.org>
Thu, 23 Jan 2020 16:06:44 +0000 (17:06 +0100)
committerHendrik Jaeger <git-commit@henk.geekmail.org>
Thu, 23 Jan 2020 16:06:44 +0000 (17:06 +0100)
.zshrc [new file with mode: 0644]
README [new file with mode: 0644]

diff --git a/.zshrc b/.zshrc
new file mode 100644 (file)
index 0000000..978b124
--- /dev/null
+++ b/.zshrc
@@ -0,0 +1,27 @@
+function henkspngpostproc () {
+    local resize_by
+    local img
+    resize_by="$1"
+    shift
+    echo "Creating Directories …"
+    mkdir --parents resized/pngnqed/optipnged optimized
+    for img in $*
+    do
+        echo "Resizing image …"
+        convert -resize $resize_by% "$img" "resized/$img"
+        echo "Running pngnq …"
+        pngnq -s1 -f -d "resized/pngnqed" -e .png "resized/$img"
+        echo "Running optipng …"
+        optipng -force -out "resized/pngnqed/optipnged/$img" "resized/pngnqed/$img"
+        echo "Moving final image to directory 'optimized' …"
+        cp --verbose --interactive --target-directory=optimized/ "resized/pngnqed/optipnged/$img"
+        echo "Removing temporary images …"
+        #rm --verbose --interactive \
+        rm --verbose \
+          "resized/$img" \
+          "resized/pngnqed/$img" \
+          "resized/pngnqed/optipnged/$img"
+    done
+    rmdir --parents resized/pngnqed/optipnged
+}
+
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..6ba2a1c
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+Function for zsh (possibly even POSIX-Shells) for resizing and optimizing scanned PNG images