Thanks again Mike, this solved everything.
d On Aug 24, 1:02 pm, Mike Ramirez <gufym...@gmail.com> wrote: > On Sunday 23 August 2009 06:48:33 pm The Danny Bos wrote: > > > > > > > Hey, so I've got this code to quickly create thumbnail files, below. > > When I give it a value, it squishes the image to those dimensions, I'm > > hoping to keep the correct proportions of a book instead of cropping > > to a square or squashing. > > > Mainly as books can be portrait, landscape or square. So keep the > > correct proportions, and make the tallest edge '120px'. > > > Know what I mean?? > > > def gen_thumb(source, dest, size=120): > > image = Image.open(source) > > w,h = image.size > > > tn = image.resize((size,size), Image.ANTIALIAS) > > tn.save(dest) > > return dest > > Try using image.thumbnail() I've found this does keep the dimensions in > proportion, regardless of the size passed to it.[1] > > Mike > [1]http://www.pythonware.com/library/pil/handbook/image.htm > > -- > You are magnetic in your bearing. > > signature.asc > < 1KViewDownload --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---