Not sure how to optimise or strip EXIF in sips, nor if it works for PNG and GIF files. If you wanted to try that, the basic command would be: sips -Z 800 somefile.jpgĪnd it will then resize the image to max 800px on either side. If you don't like ImageMagick, you could maybe use sips which is built into OSX but it is nowhere near as flexible. Go to here and install it with the line of code there. To install ImageMagick on a Mac, use homebrew. To run the script above, save it in a file called resizer, then go into Terminal and do this: chmod +x resizer # Just do this one time to make the script executable You can also insert a Copyright string and an IPTC profile to give Copyright, Contact, Source, Object and Credits information - just ask me. You could add -strip between -resize and -quality to remove EXIF data (date/time photo was taken, camera make and lens etc) to make the files smaller too. Run some tests on a single image or two first. The convert command says to resize the image so neither side is over 800px and the aspect ratio is retained, then optimise for Web and overwrite original file.Īt the moment, it does nothing, it just shows you the command it would run, so you would need to remove the word echo and run it again if you like it. GIF" or ".PNG", regardless of upper or lower case, in this directory and all directories below, and pass their names into the while loop. starting at dot (the current directory, you can put a different starting directory here if you like), find all files called ". The command is like this, but I would create a backup first: #!/bin/bashįind.