PIL: how to do in-memory transformations ?

Andreas Jung andreas at andreas-jung.com
Mon Dec 18 03:18:19 EST 2000

I am faced with the following problem using PIL:

- a function gets an image filename and a scale factor
- the function should read the image and determine its type
- the function should scale the image by the given scale factor
- the function should return the binary data of the resized image 
  as a python string (image format must be kept (jpg/gif/...)

I have a solution that works with temporary files on the filesystem
but I need a more elegant and efficient solution that does not
use temporary files. Due to the poor PIL documentation I have
not found a suitable solution yet. Any ideas ?

Tnx, Andreas

More information about the Python-list mailing list