And if you are running at true color on Windows, Mac, Linux then you'll be
at 32-bits if you're using the default bit depth and not specifying an
explicit bit depth argument to wxImage and wxBitmap. Depending on how many
images you have kept around you could be eating up a lot of RAM, real and/or
virtual so you should look at the memory usage in Python and the OS while
the program is running. If you are paging out to disk that is going to be
slow. You could check your refcount to make sure you don't have a memory
leak too, though offhand I can't remember the syntax.
I wonder if the amount of video RAM on your video card will have any impact
on these operations. I'm not sure when using the various wxDCs, when an
operation gets put off onto the video card, if ever. Maybe it never does.
ka
···
-----Original Message-----
From: Jeff ShannonBob Klimek wrote:
>
> But the zooming is still slow since wxPython (or PIL) still has to
> scale the image. After clicking the zoom button 3 times, the image
> size goes from 512x512 to 4096x4096. The last zoom step takes about 2
> seconds. However, clicking the zoom one more time hangs the program
> for about 20 seconds and then prints the following traceback: ....Well, let's presume that you're using 24-bit color bitmaps. Even if the
source bitmaps aren't that depth, I suspect that PIL and wxImage will
use at least that much internally.4096x4096 is about 16.7 million pixels, and at 24-bit depth that's 48MB
of data. 8192x8192 is about 67 million pixels, or about 192MB of data.
Even if your machine has 256MB or more of RAM, you're likely to run
into some serious memory-handling problems -- especially considering
that, as you convert a 200MB PIL image into a 200MB wxImage, you're
using almost 400MB of memory. And don't forget that this is *only* the
raw storage for the image data, it doesn't include any other data (or
code) in your program, any other processes running on the system,
etc, etc.It's possible that this might work on a system with 1GB or more of RAM,
but I wouldn't be surprised if the toolkits (wxPython and PIL) just
aren't capable of handling images that large.