Well, a quick tangential note: your method for extracting the extension
name[-4:]
is buggy. What if the file extension is ".jpeg"?
Better:
filename, ext = os.path.splitext(name)
if ext == ".tif":
do stuff ...
savedfile = filename+".jpg"
do more stuff...
jrcagle
Practically a Master Poster
608 posts since Jul 2006
Reputation Points: 92
Solved Threads: 156
WRT to the main problem, the memory error, I agree that there's something wrong, and it doesn't appear to be your code.
You might try e-mailing the PIL support at
[email]image-sig@python.org[/email]
Jeff
jrcagle
Practically a Master Poster
608 posts since Jul 2006
Reputation Points: 92
Solved Threads: 156
Try running everything after "if name[-4:] == ".tif":" in a separate function. The memory should be garbage collected when the function exits.
woooee
Nearly a Posting Maven
2,454 posts since Dec 2006
Reputation Points: 777
Solved Threads: 714