Search code examples
macosapplescriptautomator

Convert Images using AppleScript and Finder


I'd like to convert some specific images (jpg) to another type of image file, using AppleScript (PNG, jpg2000, or similar - should have good image quality). The images that I want to convert are all in one folder. There are no other files in this folder, except for the images.

How can I simply tell Finder to convert all of these images to another type of image and to replace the original images in the folder?

I'm new to AppleScript and it would be very nice if someone could help me out.


Solution

  • The Finder doesn't know how to convert images, you will need to use something like the Preview application or a utility such as Image Events. You can use AppleScript, but for this it would probably be easier to just use Automator, for example:

    Create a new workflow document, and drag actions from the library:

    • Ask for Finder Items { Type: Folders }
    • Get Folder Contents

      -- or --

    • Ask for Finder Items { Type: Files, Allow Multiple Selections }

      -- then --

    • Change Type of Image { To Type: whatever }

    The Change Type of Image action will ask if you want to add a Copy Finder Items action to make copies to work with instead of the originals.