Pad an image with color other than black?

I have a simple Applescript to resize and image and then pad it to make the image square in aspect ratio.
The default color for padding the image is black, and I’m trying to pad the image with white.

The URL: http://developer.apple.com/releasenotes/AppleScript/RN-AppleScript/index.html says,
“… The pad command has an optional with pad color parameter. [5234464] …”

This leads me to think its possible, but I haven’t been able to figure out how to do it, nor have I found any examples of the correct syntax. I’ve also found the man page for "sips – scriptable image processing system with the following entries:

 -p pixelsH pixelsW
 --padToHeightWidth pixelsH pixelsW
       Pad image with pixels to fit specified size.

 --padColor hexcolor
       Use this color when padding. White=FFFFFF, Red=FF0000, Default=Black=000000

I found another reference that talks about doing a system call from Applescript, so that seems like another option, but again I haven’t found enough details to figure out how to do it.

Anyone know how to pad an image with white instead of black ?

Model: imac
Browser: Firefox 2.0.0.15
Operating System: Mac OS X (10.5)

Hi,

it seems not to work.
Neither using Image Events nor sips like


set this_file to choose file
do shell script "/usr/bin/sips -p 180 180 --padColor FF0000 " & quoted form of POSIX path of this_file

It pads the image but the color is always the same

Hmmm, curious. I tried your scripts on my mac, but they didn’t compile. I also discovered that ‘sips --help’ on my mac doesn’t return all the options (and notably the --padColor option) that I found on the online docs. Seems like there is a version issues here.

Thanks for your help, though.