Skip to content

Instantly share code, notes, and snippets.

@hgdeoro
Created March 15, 2013 01:39
Show Gist options
  • Save hgdeoro/5166874 to your computer and use it in GitHub Desktop.
Save hgdeoro/5166874 to your computer and use it in GitHub Desktop.
Run gmic on various files and report performance
#!/bin/bash
#
# TODO: use time from `time` command, not from 'end-start'
#
if [ -z "$(which exiv2)" ] ; then
echo "ERROR: exiv2 required. On Ubuntu, install with 'sudo apt-get install exiv2'"
exit 1
fi
if [ -n "$(which lsb_release)" ] ; then
RELEASE="$(lsb_release -d)"
else
RELEASE=""
fi
echo "#csv,release,resolution,input,output,hostname,start,end,time"
while [ -n "$1" ] ; do
echo "------------------------------------------------------------"
echo "Starting GMIC with file $1 at $(date)"
echo "------------------------------------------------------------"
OUTPUT="denoised-$(hostname)-$1"
test -e $OUTPUT && rm -fv $OUTPUT
start=$(date +%s)
time gmic $1 -denoise 30,10 -o $OUTPUT
end=$(date +%s)
echo ""
echo "Finished at $(date)"
echo ""
IMAGE_SIZE=$(exiv2 $1 | grep "^Image size" | cut -d : -f 2)
echo "csv,$RELEASE,$IMAGE_SIZE,$1,$OUTPUT,$(hostname),$start,$end,$(($end-$start))"
shift
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment