title: Python: Image resizing: keep proportion - add white background
body: <p><strong>I would like to create a Python script to resize images, but not changing its proportions, just by adding a white background</strong></p>
  
  <p>(So, a : 500*700 px  image would transform to a 700*700 px image by adding 100 px of a white band on each side)</p>
  
  <p><strong>The three image types I use are .PNG, .JPG and .GIF</strong>. I am not even sure it is possible for Gifs, PNG and JPG would already be awesome. </p>
  
  <p><strong>In my case, they have to be squares.</strong> But if any of you manage to do it for adaptable to any proportion, it would benefit the maximum number of people that see this thread and you would be even more awesome !</p>
  
  <p>I saw same threads for other languages but not python, do you guys know how you do this ?</p>
  
  <p>PS : I am using Python 3</p>
  
  <p><strong>What I tried :</strong></p>
  
  <p>Combining 3 images together.</p>
  
  <p>If we take our 500*700 px image :
  Creating two white images of 100*700px and put one on each side of the image. Inspired by : </p>
  
  <p><a href="https://stackoverflow.com/questions/30227466/combine-several-images-horizontally-with-python">Combine several images horizontally with Python</a></p>
  
  <p>But, I am kind of new on python, and I haven't succeded.</p>