title: What's the simplest way to resize an image to a given bounded area?
body: <p>I'd like to create a function, like:</p>
  
  <pre><code>def generateThumbnail(self, width, height):
       """
       Generates thumbnails for an image
       """
       im = Image.open(self._file)
       im.thumbnail((width, height), Image.ANTIALIAS)
       im.save(self._path + str(width) + 'x' + 
               str(height) + '-' + self._filename, "JPEG")
  </code></pre>
  
  <p>Where a file can be given and resized.</p>
  
  <p>The current function works great except it does not crop when necessary.</p>
  
  <p>In the case that a rectangular image is given, and a square resize is required (width = height), some centered-weighted cropping will have to be done.</p>