I really hate it when people mail me super large pdf files and therefore I myself compress them before I send them out. Unfortunately, the build-in OS X Scanner application does not provide pdf compression. Luckily, there is Ghostscript and someone already wrote a small script to make this process handy.
This script worked for me most of the time but I always got a warning and sometimes it just crashed:
SetUseCIEColor for UseDeviceIndependentColor to work properly
Unrecoverable error: stackunderflow in .setdistillerparams
After adding -dUseCIEColor
I got rid of them and the script now looks as
follows