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 +++++++++++++++++++++ .config/init/funcs/make-gif | 40 +++++++++++++++++++++------------------- 2 files changed, 42 insertions(+), 19 deletions(-) create mode 100755 .config/init/funcs/gifo (limited to '.config/init/funcs') 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 diff --git a/.config/init/funcs/make-gif b/.config/init/funcs/make-gif index 3221e97..e100650 100755 --- a/.config/init/funcs/make-gif +++ b/.config/init/funcs/make-gif @@ -10,9 +10,9 @@ usage() { echo "" echo " description option default val" echo " start time -s