From 5aba9de367932be46aa471c71076d9e623d5abce Mon Sep 17 00:00:00 2001 From: katherine Date: Wed, 1 Mar 2017 00:54:06 -0700 Subject: snapshot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit various smöl changes --- .config/init/funcs/gifo | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 .config/init/funcs/gifo (limited to '.config/init/funcs/gifo') diff --git a/.config/init/funcs/gifo b/.config/init/funcs/gifo new file mode 100755 index 0000000..854b45a --- /dev/null +++ b/.config/init/funcs/gifo @@ -0,0 +1,21 @@ +#!/usr/bin/env zsh +# optimise gifs with gifsicle + +local before +local after +local ofile + +for i in $@; do + if [[ -f "$i" ]]; then + ofile="$i.out" + while [[ -f "$ofile" ]]; do + ofile="$ofile.out" + done + du -h "$i" | cut -f 1 | read before + echo "$i..." + gifsicle --no-ignore-errors -w -O3 "$i" -o "$i.out" + [[ -f "$ofile" ]] && rm "$i" && mv "$ofile" "$i" && \ + du -h "$i" | cut -f 1 | read after && \ + echo " $before -> $after" || echo " failed" + fi +done -- cgit v1.2.3