title: Python PIL/Pillow - Pad image to desired size (eg. A4)
body: <p>I have a JPG/PNG/PDF image, and I'd like to get it on a A4 page, centered, as PDF (FYI: so that it's easy for my end-users to display/print it).</p>
  
  <p>In either order:</p>
  
  <ul>
  <li>pad the image to fill an A4 (with white)</li>
  <li>transform to PDF</li>
  </ul>
  
  <p>I can do <code>im.save('filename.pdf', 'PDF', resolution=100.0)</code> to save an <code>Image</code> object to PDF, but I don't know how to do the other task.</p>
  
  <p>I'd really prefer using Pillow, but other answers are welcome.</p>