Acorn Acorn 5

Using Automator and AppleScript to compress a folder full of JPEG files

Maybe you have a folder full of JPEG images that you want to re-compress so that they aren't taking up so much room on your disk, or maybe you're delivering them over the web and you don't want to use up all of your bandwidth.  If there are tens or hundreds of images, wouldn't it be great to automate the process?  You can do this using Automator and Acorn!

Open up the Automator application (it's located in your Applications folder), and make a new Workflow.  Next, add a "Get Specified Finder Items" action from the Library on the left of your Automator window.  If you need help finding the action, you can quickly search for it in the search field.  Use the Add… button on the Finder action to select your images.  You can also drag and drop them all into the table.

Now add a "Run AppleScript" action below the Finder action, and paste in the following AppleScript:

on run {input, parameters}

    repeat with fileAlias in input

        tell application "Acorn"

            set doc to open (POSIX path of fileAlias)

            -- if you want to overwrite the original file,

            -- remove the '& "-exported.jpeg"' bit.

            set newPath to (POSIX path of fileAlias) & "-exported.jpeg"

            tell doc

                web export in newPath as JPEG quality 25


            end tell

        end tell


    end repeat

    return input

end run

Finally, save your workflow.  Your workflow should look like this:


And your images will be written into the same folder as the originals, with "-exported.jpeg" appended to the end of the name.

You can also download the workflow from here:

Note For App Store Users: If you've purchased Acorn from the Mac App Store, certain AppleScripts, Automator Actions, and JSTalk scripts may not work for you because of sandboxing restrictions required by Apple.  The direct version of Acorn does not have these issues.

Automator Warning: If Automator gives you some sort of warning about the Action not working correctly, save your action and try again.