Python Image Manipulation

  • Thread starter Scott Brady Drummonds
  • Start date
S

Scott Brady Drummonds

Can anyone recommend the easiest way of generating thumbnail images using a
Python library? I've seen that the Python Image Library (PIL) seems to do
this but it isn't installed on my available systems. I'd prefer to use
something distributed with Python, if possible, but will install the library
that makes this functionality easy as a second choice.

Thanks!
Scott
 
D

deelan

Scott said:
Can anyone recommend the easiest way of generating thumbnail images using a
Python library? I've seen that the Python Image Library (PIL) seems to do
this but it isn't installed on my available systems. I'd prefer to use
something distributed with Python, if possible, but will install the library
that makes this functionality easy as a second choice.

i'm not aware of python built-in functions to resize images,
but with PIL is dead easy to make thumbnails, check:

from "Python is Kung-Fu for the Web":
<http://blog.mans.de/archives/2004/03/28/python-is-kung-fu-for-the-web/>

import Image
im = Image.open(filename)
im.thumbnail((200, 200), Image.ANTIALIAS)
im.save(thumbnail, "JPEG", quality = 80, optimize = 1)

you can also feed to open() a file(-like) object, instead
of a filename.

HTH,
deelan.
 
R

Ravi Teja Bhupatiraju

Scott Brady Drummonds said:
Can anyone recommend the easiest way of generating thumbnail images using a
Python library? I've seen that the Python Image Library (PIL) seems to do
this but it isn't installed on my available systems. I'd prefer to use
something distributed with Python, if possible, but will install the library
that makes this functionality easy as a second choice.

Thanks!
Scott

The easiest way is using PIL. There is sample code in the PIL
documentation that you can use directly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,204
Messages
2,571,063
Members
47,670
Latest member
micheljon

Latest Threads

Top