Skip to content

Acorn Is Scriptable!

I oscillate between Acorn and Pixelmator on the Mac – its great to have two competent alternatives to Photoshop. Pixelmator is my current fav on the iPad Pro (there’s nothing like using it’s object removal with the Apple Pencil). However, today Acorn has me on the Mac because it is scriptable. Whipped up this little script to generate images for Script Debugger 6 release notes:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

on downsampleImage(theFile)
    local destFolderHFSPath
    tell application "Finder"
        set destFolderHFSPath to get folder "Web" of desktop as string
    end tell
    tell application "Acorn"
        tell (open theFile)
            local imageName, imageWidth, imageHeight
            set {imageName, imageHeight, imageWidth} to {name, height, width}
            --  Create 1x down sampled image
            web export width (imageWidth * 0.328) height (imageHeight * 0.328) as PNG in file (destFolderHFSPath & imageName & ".png")
            --  Create 2x down sampled image
            web export width (imageWidth * 0.65) height (imageHeight * 0.65) as PNG in file (destFolderHFSPath & imageName & "@2x.png")
            close saving no
        end tell
    end tell
end downsampleImage

on open theFiles
    repeat with aFile in theFiles
        downsampleImage(contents of aFile)
    end repeat
end open

No fuss, it just worked.


  1. Romain Van Aelst Romain Van Aelst

    When it comes to automating and batch processing of images, then GraphicConverter is my choice. Did you try this application?

  2. Of course, there are many tools available to scale images. As good as GraphicConverter is, because I use it infrequently, I find it’s scripting interface a bit of a puzzle. I’m pointing out that Acorn scripting interface works, and was a pleasant surprise.

  3. Christopher Stone Christopher Stone

    Hey Mark,

    Cool. Thanks for the heads-up.

    On first inspection Acorn’s AppleScript dictionary looks pretty functional. It’s nice to be able to script an app without having to fight it.

    — Take Care, Chris

Comments are closed.