[Zope] PIL, ImageTag, compression, antialias and mode

Jaroslav Lukesh lsh@wo.cz
Wed, 20 Nov 2002 14:21:08 -0000


Hi all,

I was done thumbnail images. I find that ABSOLUTELLY BEST ONE and UNIVERSAL
is ImageTag (called) "hotfix" (I was walk through whole zope mailinglist
archive too).

For those like me, creating+auto_caching of thumbnails are:
<img src="image.jpg/thumb?width=150&height=300">

But I do not know how:

* I can give compression level and compression type (huffman_optimized,
progressive level) for JPEG files

* I want to add antialiasing (I have PIL 1.1.3/W32 installed)
	im.resize((width,height),PIL.Image.ANTIALIAS)
	= it does not work for me with image.thumbnail :(( 
	but I can do something wrong, I'm not familiar with Python (it is not 8048
assembler 8-))

* I want original file format (last line from codes below)

* If I will update source image, how to tell to Cache for Invalidate?

Original part from ImageTag "hotfix" __init__.py:
        #create a thumbnail image file
        original_file=StringIO(str(self.data)) #use str() in case data is
Pdata
        image=PIL.Image.open(original_file)
        image=image.convert('RGB')
        image.thumbnail((keys['width'],keys['height'])) 
        thumbnail_file=StringIO()
        image.save(thumbnail_file, "JPEG") 

I would be very happy if you could help me with corrections and add
compression level option:

        #create a thumbnail image file
        original_file=StringIO(str(self.data)) #use str() in case data is
Pdata
        image=PIL.Image.open(original_file)
        image=image.convert('RGB')
        image.thumbnail((keys['width'],keys['height']),PIL.Image.ANTIALIAS)
        thumbnail_file=StringIO()
        image.save(thumbnail_file, image_type) 


Many thanks for your kindly assistance.

J. Lukesh