PIL and jpg -> png conversion

Raaijmakers, Vincent (IndSys, Raaijmakers, Vincent (IndSys,
Tue Nov 18 03:11:05 CET 2003


os.tmpfile()
Never thought about that one.
Definitely worth a try. 
Thanks!!

-----Original Message-----
From: python-list-bounces+vincent.raaijmakers=ge.com at python.org
[mailto:python-list-bounces+vincent.raaijmakers=ge.com at python.org]On
Behalf Of Erik Max Francis
Sent: Monday, November 17, 2003 5:34 PM
To: python-list at python.org
Subject: Re: PIL and jpg -> png conversion


"Raaijmakers, Vincent (IndSys, GE Interlogix)" wrote:

> Well, because in the first option, I need to read and write to and
> from disk is not an elegant programming option, I prefer to do the
> latter. Unfortunately, this seems only to work for GIF and JPEG, but
> not for PNG.
> As a test I try to reconvert the file output to an image again but the
> image.verify() throws an fp.seek.tile error. This only happens with
> PNG files.

Presumably PIL in general needs seek ability while reading files.  If
that means you can't use StringIO, and you don't want files lying around
you have to clean up, why not use os.tmpfile?  It might be spooled to
disk (then again, it might not; it could spool to a RAM disk), but it'll
allow you to do what you need and there won't be any leftover files
lying around afterwards.

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ 
\__/ The only way to get rid of a temptation is to yield to it.
    -- Oscar Wilde
-- 
http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list