title: Adding borders to an image using python
body: <p>I have a large number of images of a fixed size (say 500*500). I want to write a python script which will resize them to a fixed size (say 800*800) but will keep the original image at the center and fill the excess area with a fixed color (say black). </p>
  
  <p>I am using PIL. I can resize the image using the <code>resize</code> function now, but that changes the aspect ratio. Is there any way to do this?</p>