Skip to content

Instantly share code, notes, and snippets.

@antonpirker
Created August 6, 2014 08:55
Show Gist options
  • Save antonpirker/9836bcb9db928ef1a8d8 to your computer and use it in GitHub Desktop.
Save antonpirker/9836bcb9db928ef1a8d8 to your computer and use it in GitHub Desktop.
Convert all images in a directory tree recursively to gray scale and put them into out folder.
for f in `find . -name "*.jpg"`
do
#echo "mkdir -p `echo out$f | xargs dirname | sed "s/\.\//\//"`"
mkdir -p `echo out$f | xargs dirname | sed "s/\.\//\//"`
#echo "convert $f -set colorspace Gray -separate -average `echo out$f | sed -e "s/\.\//\//"`"
convert $f -set colorspace Gray -separate -average `echo out$f | sed -e "s/\.\//\//"`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment