Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Batch Scaling images and Padding in White color with Automator in Mac OS

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

like image 388
user3882010 Avatar asked Dec 04 '25 14:12

user3882010


1 Answers

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.

like image 51
Gene Z. Ragan Avatar answered Dec 07 '25 15:12

Gene Z. Ragan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!