Performance of reading from Jpeg

I'm writing a wxPython application that displays jpeg images in two frames. Currently, it's a single image at a time, but I will be doing multiple ones. The reason for the second frame is that a second monitor (a large HDTV) is used just for images. Each image is displayed in both frame, but with different scaling.

Environment wxPython version: 2.8.9.2 (msw-unicode), on 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)], On Windows XP SP3.

My problem is that images are taking too long to display. From my measurements, most of the time (0.5 to 0.8 secs for each image) is spent in the line:
                    self._img = wx.Image(self.fname, wx.BITMAP_TYPE_ANY)

I am also potentially rotating the image, and of course I copy/scale it (or a crop of it) to a DC. But it appears the line above is the real bottleneck.

The jpeg images are at approximate resolution 3800x2600 pixels. I could pre-process them for a smaller size, but I'd rather not. The second monitor is 1920x1080, and I will be displaying a crop of the original image.

Could some other format help? Or using PIL or something else to store this (intermediate) image?

Thanks for any suggestions.

Dave Angel escribió:

I'm writing a wxPython application that displays jpeg images in two frames. Currently, it's a single image at a time, but I will be doing multiple ones. The reason for the second frame is that a second monitor (a large HDTV) is used just for images. Each image is displayed in both frame, but with different scaling.

Environment wxPython version: 2.8.9.2 (msw-unicode), on 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)], On Windows XP SP3.

My problem is that images are taking too long to display. From my measurements, most of the time (0.5 to 0.8 secs for each image) is spent in the line:
                   self._img = wx.Image(self.fname, wx.BITMAP_TYPE_ANY)

I am also potentially rotating the image, and of course I copy/scale it (or a crop of it) to a DC. But it appears the line above is the real bottleneck.

The jpeg images are at approximate resolution 3800x2600 pixels. I could pre-process them for a smaller size, but I'd rather not. The second monitor is 1920x1080, and I will be displaying a crop of the original image.

Could some other format help? Or using PIL or something else to store this (intermediate) image?

Thanks for any suggestions.

Just to add a comment... If the application (and its use case) allows it, you could make an "image cache" in a background thread/process while the user is watching some image in foreground. This is very common in image viewers, which preloads the next (one or two) images in the viewing list.

Regards
Marcelo

···

--
Marcelo F. Fernández
Buenos Aires, Argentina
Licenciado en Sistemas - CCNA

E-Mail: fernandezm22@yahoo.com.ar
Jabber ID: fernandezm22@jabber.org
Public Key ID: 5C990A6C 111C3661
Blog: http://marcelosoft.blogspot.com