Question

I'm trying to resize new image files in a folder using a folder action so the files that were already resized to 300x250 don't get resized again. The thing is I'm having issues getting the resizing to happen at all..

Here is my current Automator Workflow: enter image description here

It works when I test it by adding "Get Selected Finder Items" but when I close automator and I add new files to the folder nothing happens. I'm using Hazel to move jpgs to the folder, but nothing is happening to the files after they are moved into the folder to be resized

Was it helpful?

Solution

As you already have Hazel installed anyway, it might be easier to use it to trigger the image resizing as well. Create a new rule in Hazel to watch the folder and execute the command:

enter image description here

OTHER TIPS

You'll have to run it in a loop, otherwise it won't work(as you may saw :) )

Run this instead

for f in "$@"
   do
     sips --resampleHeightWidth 250 300 "$f" 
   done

The step by step option provided by Automater is very helpful. Also, when testing use the "Ask for Finder Items" action including "Allowing Multiple Selection".

enter image description here

You could also use ImageMagick:

brew install imagemagick
for f in /path/to/mat/*; do
  if [[ $(identify -format %wx%h "$f") != 300x250 ]]; then
    convert "$f" -filter lanczos2 -resize 300x250 "$f"
  fi
done

sips and Automator (which use an identical resizing method) make images look fairly blurry if you don't add any sharpening. Below the image on the left side was resized with sips --resampleWidth 300 and the image on the right side was resized with convert -filter lanczos2 -resize 300x:

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top