r/applescript • u/linnic • Jul 01 '22
Automating Image Compression with ImageOptim
Looking for some input on how or the best way to do this. I currently have a folder of pictures that is synced and updates daily, but is getting quite large.
Goal: I'm trying to set up an automation where when the file lands in the folder (or sub-folder) that it is automatically sent to ImageOptim to compress the image.
I've tried using automator and applescript, but I'm getting a bit lost as i'm not really good at either one. I also considered keyboard maestro or hazel. I keep getting stuck at opening the application, then trying to select the file. Also wondering if I have multiple pictures uploaded at once will it try to open the program repeatedly and cause an error there?
Any help or advice is very much appreciated! Thanks
View all comments
Show parent comment
1
u/linnic Jul 04 '22
Hi AmplifiedText. I'm trying to implement it right now and realizing how little I know about shell scripts. It ran nicely on the top level folder, but I couldn't replicate it on the subfolders without manually attaching the action to each folder. I tried to resort to hazel which has a subfolder action function and shell script action option, but the script did not run correctly there. I'm assuming because it is no longer a folder action and the rule matches each individual image file instead. Do you mind helping me out a bit with the script please?