3

Using Automator in Mac OS i am trying to do batch Padding and scaling images. I tried to Batch Scale images to a particular size along with padding.

  1. It doesn't work if i drag and drop entire folder into the Automator, Only works for multiple image drag and drop.
  2. And for padding i am getting the Color Black where i need it to be white

I Already tried using the Created Automator Application>Library>Photos>Pad Images

And then gave Canvas dimensions then Scale images before padding option

SomethingDark
  • 13,229
  • 5
  • 50
  • 55
user3882010
  • 31
  • 1
  • 3
  • Please give an example of exactly what you want to do. What size(s) are your input images? What size should your output images be? Do you want them padded on all four sides or just top and bottom or just left and right or just right and bottom? Are they GIF files or PNG files? – Mark Setchell Feb 21 '15 at 09:47
  • Very helpful documentation here: https://macosxautomation.com/applescript/imageevents/05.html – dj.cowan Jul 11 '19 at 01:32

2 Answers2

7

The Automate Pad Image action fills the canvas with black as the default color. Sadly, there is no way to modify this default action.

What you can do, is add a "Run AppleScript" action to call the sips command line tool to pad the image using the color that you want.

To do this, click on the Utilities Action in the Automator sidebar and add a "Run AppleScript" Actions.

Replace the default AppleScript code with the following code:

on run {input, parameters}  
repeat with this_file in input
    set this_path to the quoted form of the POSIX path of this_file
    do shell script "sips " & this_path & " -p 50 50 --padColor FFFFFF -i"
end repeat
return input
end run

The -p argument specifies the width and height of the padding. The --padColor argument specifies the color. In this case, the color is white. FFFFFF is equal to 255, 255, 255 in RGB colors.

You can type "sip --help" on the command line in the terminal to see all of the cool things that the command can do.

Gene Z. Ragan
  • 2,643
  • 2
  • 31
  • 41
-2

I had the same question - found the answer today without spending money. SIPS is built-in to Mac OS X - command line graphics scripting.

I have attached a screenshot of my automator script: - make a copy of your images folder first - select your image folder for resizing - in the command line setting I have hard coded 300 as my images needed to be padded to 300px

![Use automator with Unix Commandline][1]

Image not allowed