Skip to content

Instantly share code, notes, and snippets.

@caro3801
Last active September 9, 2016 12:10
Show Gist options
  • Save caro3801/848cb6c80073775e32ea14afce46df3b to your computer and use it in GitHub Desktop.
Save caro3801/848cb6c80073775e32ea14afce46df3b to your computer and use it in GitHub Desktop.
OS X Automator shell script to convert image to eps (LaTeX FTW)
#convert tool to download http://www.imagemagick.org/script/convert.php
#Step 1 : In automator > New folder action : select the folder to watch
#Step 2 (only for testing) : Add "Get elements from the folder indicated" -> select few images from different origins
#Step 3 : Add a shell script with the following code
for f in "$@"
do
filename=$(basename "$f")
base="${filename%.*}"
newbase="${base//[^A-Za-z0-9_-]}"
dest= "${/absolute/path/to/my/eps/folder}
"/usr/local/bin/convert" "$f" "$dest/$newbase.eps"
done
#improvements: add a condition to check the file format you want to convert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment