在PHP中,我可以以编程方式调整图像大小并添加空格吗?

I've found some similar questions to mine, but none that address my specific situation, so I thought I'd ask.

What I have: A square JPEG, measuring 600px x 600px, that I am getting from an external source.

What I want: To programmatically resize the square to 400x400, and add 75px of white space on each side, making the total final image 550px x 400, with the original square image centered.

I'd be grateful if somebody can point me in the right direction.

php.net/manual/en/ref.image.php

These functions are be able to do exactly what you want, and they are pretty simple to use as well.