title: PIL: enlarge an image
body: <p>I'm having trouble getting PIL to enlarge an image.  Large images get scaled down just fine, but small images won't get bigger.</p>
  
  <pre><code># get the ratio of the change in height of this image using the
  # by dividing the height of the first image
  s = h / float(image.size[1])
  # calculate the change in dimension of the new image
  new_size = tuple([int(x*s) for x in image.size])
  # if this image height is larger than the image we are sizing to
  if image.size[1] &gt; h: 
      # make a thumbnail of the image using the new image size
      image.thumbnail(new_size)
      by = "thumbnailed"
      # add the image to the images list
      new_images.append(image)
  else:
      # otherwise try to blow up the image - doesn't work
      new_image = image.resize(new_size)
      new_images.append(new_image)
      by = "resized"
  logging.debug("image %s from: %s to %s" % (by, str(image.size), str(new_size)))
  </code></pre>