From 154a1fe369e637eb9408ce5c18151a9308bc1660 Mon Sep 17 00:00:00 2001 From: Jan Huwald Date: Mon, 17 Sep 2012 14:25:45 +0200 Subject: [PATCH 1/1] Initial commit --- anonpic.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 anonpic.sh diff --git a/anonpic.sh b/anonpic.sh new file mode 100755 index 0000000..5684bf1 --- /dev/null +++ b/anonpic.sh @@ -0,0 +1,56 @@ +#!/bin/sh -e + +function die() { + echo -e "$*" >&2 + exit 1 +} + +function r() { + echo $(($RANDOM % $1)) +} + +max=$# +cur=1 + +[ $max -gt 0 ] || die "Usage:\n[IMG_PREFIX=your_prefix] $0 img1.jpg img2.jpg ..." +[ -x "$(which convert)" ] || die "ImageMagick is not installed" +[ -x "$(which jhead)" ] || die "jhead is not installed" + +while [ $# -gt 0 ]; do + dst="$IMG_PREFIX$(seq -w $cur $max|head -n1).jpg" + echo -e "[$((100*cur/max))%]\t$1\t-> $dst" + + [ -f "$1" ] || die "$1 does not exist" + (! [ -e "$dst" ]) || die "$dst already exists" + + read W H <