I have several .pngs that are 586 x 428. I need to convert them into .pngs that are 512 x 512. I want to do this without stretching the image at all. So basically, I want to scale the width down to 512, then add an equal amount of transparency in the height both above and below the original image.
So, the final product would be a .png that is 512 x 512, and 69px of transparency in height on top and bottom, leaving the "colored" part of the image to be 512 x 374.
I am trying to do this with Python Imaging Library. I am pretty new to this, so if someone can help me with this, that would be much appreciated.