nasa-apod-desktop
nasa-apod-desktop copied to clipboard
Keep the aspect ratio through ImageOps.fit
With the use of ImageOps.fit the aspect ratio of the picture isn't distorted. This cuts off (in a pretty dumb way) that is outside of the center. A better approach might be something based on image entropy to cut out "uninteresting" parts of the images. Reddit uses a setup similar to this to make good thumbnails.
You can also do this:
imgsize = 900, 900
img.thumbnail(imgsize, Image.ANTIALIAS)
Which will preserve the aspect ratio intelligently.