Created
June 20, 2013 01:55
-
-
Save timf/5819731 to your computer and use it in GitHub Desktop.
Pass an X.tiff file to this --> X.png
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echoerr() { echo "$@" 1>&2; } | |
if [ "X" == "X$1" ]; then | |
echoerr "error: requires argument: path to .tiff file" | |
exit 1 | |
fi | |
exe=`which sips` | |
if [ "X" == "X$exe" ]; then | |
echoerr "error: cannot find sips program" | |
exit 1 | |
fi | |
outputfile=`echo "$1" | sed 's/\.tiff$/\.png/'` | |
if [ "$1" == "$outputfile" ]; then | |
echoerr "error: file must end in .tiff" | |
exit 1 | |
fi | |
if [ -f $outputfile ]; then | |
echoerr "error: already exists: $outputfile" | |
exit 1 | |
fi | |
CMD="$exe -s format png $1 --out $outputfile" | |
echo "Running: $CMD" | |
exec $CMD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment