[visionegg] Re: pre-loading a large number of stimuli

Hi Nick,

I think the method you are looking for may be Image.load() from 
PIL. VisionEgg calls Image.open(filename) in Texture.__init__ in 
Textures.py, which as you note opens a file but doesn't necessarily 
actually read any data until it is accessed. 

Since Textures can be created from PIL images as well as from 
filenames, you may be able to do what you want by first explicitly calling 
Image.open(filename), then calling load() on the image object you just 
created, and finally passing the newly-loaded image as the argument to the 
Texture constructor. 

Whether or not this will actually cause the file handles to be closed and
therefore fix your problem, I'm not sure. :) Seems reasonable, though.

FYI, everything I know about the PIL im.load() method comes from here:

http://www.pythonware.com/library/pil/handbook/image.htm

  -- jascha

> What I'm looking for is a way to force PIL to read the data from the  
> file and then close the file; I'm not conversant enough with PIL to  
> know how to force this and was hoping somebody on the list might know  
> (I haven't figured out in VisionEgg where in the process PIL is used  
> to actually load the Texture into open gl, thus closing the file  
> handle).

======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: