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.
I Already tried using the Created Automator Application>Library>Photos>Pad Images
And then gave Canvas dimensions then Scale images before padding option
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With