Re: Simple script to make .png thumbnails from .zip archive...

2006-06-20 Thread K P S
Thanks a lot! This is what I ended up with. (I would like to get rar archive support, but browsing the web it looks like rar support isn't in any python library (yet)) :-( Anyway, I was able to use the below code unchanged to create thumbnails in nautilus based on the first .jpg file in a .zip ar

Re: Simple script to make .png thumbnails from .zip archive...

2006-06-20 Thread [EMAIL PROTECTED]
K P S wrote: > Thanks everyone. > routines to list all the files in a zip archive, but I don't see any to > list only the first, or only the second, etc. It doesn't look like If you can list all the files, then you can list only the first. :-) Don't worry about python internal allocation proced

Re: Simple script to make .png thumbnails from .zip archive...

2006-06-19 Thread K P S
Thanks everyone. One last thing (I hope). How can I get the name of just the first file in a zipfile? I see routines to list all the files in a zip archive, but I don't see any to list only the first, or only the second, etc. It doesn't look like zipfile is storing info in a useful array that I

Re: Simple script to make .png thumbnails from .zip archive...

2006-06-19 Thread Fredrik Lundh
K P S wrote: > What I want is a little more involved, I guess, since I > don't know the name of the file (for the zip.read command) the first example on this page shows you how to get the names of all files in a zip file: http://effbot.org/librarybook/zipfile.htm -- http://mail.python.

Re: Simple script to make .png thumbnails from .zip archive...

2006-06-19 Thread Fredrik Lundh
K P S wrote: > I'm able to read a .jpg from a .zip archive, but can't seem to > manipulate it. If I do this: > > zip=zipfile.ZipFile(inURL,mode="r") > picture=zip.read("00.jpg") > > I get the image, but it is of "type" ZipFile. string, more likely (zip is a ZipFile object, picture is a string

Re: Simple script to make .png thumbnails from .zip archive...

2006-06-19 Thread Ant
Try adapting the other posters example with something like: import Image, StringIO zip=zipfile.ZipFile(inURL,mode="r") picture=zip.read("00.jpg") image = Image.open(StringIO(picture)) image.thumbnail ((128,128), Image.ANTIALIAS) image.save (file + '.thumb.png') I haven't tested it, but some

Re: Simple script to make .png thumbnails from .zip archive...

2006-06-19 Thread K P S
Thanks a lot. I'm really new to python, and haven't coded in over a decade, so please be patient. :-) I'm able to read a .jpg from a .zip archive, but can't seem to manipulate it. If I do this: zip=zipfile.ZipFile(inURL,mode="r") picture=zip.read("00.jpg") I get the image, but it is of "type"

Re: Simple script to make .png thumbnails from .zip archive...

2006-06-18 Thread Scott David Daniels
hdante wrote: > there are too many ways to create a thumbnail from an > image. I'll cite one, using the "python image" external module, that > I've found to be very easy: > > import Image > def process(file): > try: > image = Image.open(file) > image.thumbnail ((128,128), Image.ANT

Re: Simple script to make .png thumbnails from .zip archive...

2006-06-18 Thread hdante
Hi, I don't know zipfile by heart, but python official documentation is always good ( docs.python.org ). You need a loop in the file list like this: for file in zip: process(file) Unfortunatelly, there are too many ways to create a thumbnail from an image. I'll cite one, using the "pyth

Simple script to make .png thumbnails from .zip archive...

2006-06-18 Thread K P S
Hi. I'm looking for a small script that will take a .zip archive and pull the first .jpg from the archive and convert it to a .png. The reason for this is I want to have tuhmbnails for these archives in nautilus under gnome. I would like something similar to the following code, which will pull