Running out of memory errors with pillow and python 2.7.10

583 views Asked by At

I am experiencing seemingly random errors in a 32bit python 2,7,10 using the latest pillow release 2.8.2 on win7

My setup is the following: I have a main window that shows an image in a canvas loaded via

img=Image.open(...)

self.img=ImageTk.PhotoImage.(img)

However, I also have an overview window that displays a scaled down version of the same image, basically using the same approach starting with the current filename. As long as the images aren't well beyond 10k x 5k pixels, I do not seem to encounter problems. However, once I get beyond that limit, I get IOStream Errors and out of memory errors. Using the 64bit version has, as expected, not yet produced the same errors (as more memory can be used by python).

If you are interested in seeing the actual piece of software, its freely available at: https://sourceforge.net/projects/itagbiology/

No, this is not a post to generate downloads. You will see that the small size image loads very slowly. If you load up huge images larger than 10k x 5k (depending on your pc), it will sometimes crash.

I'm sort of lost here, since I cannot think of anything to catch errors, since an out of memory error can occur at any time! I have caught the ioerror by replacing the preview image with a blank image, however, the main image must be guaranteed to load.

Any help is appreciated.

0

There are 0 answers