![](https://secure.gravatar.com/avatar/89216dd750588714b8fd5b15ab239f0b.jpg?s=120&d=mm&r=g)
Hi all, Has anyone had trouble using plt.image and zooming in too far? The symptoms are either using all available memory (Linux, > 400MB) or showing a blank white window (Linux, Windows). Example:
import gui_thread <Importing wxPython... done.> from scipy import *
from scipy import plt img = plt.lena() plt.image(img)
1. Use the mouse, zoom in on the eye near the center of the image. (In linux, python's memory usage peaks and then returns to original value.) 2. Now, zoom in closer using the mouse so that just the iris and pupil would be shown. (In linux, memory usage rises to > 400MB and this disk starts swapping. In Windows, the image is not rendered but instead a white canvas is shown.) Same results can be obtained on the command-line:
z=plt.image(img) z.x_axis.bounds = [245,250] z.y_axis.bounds = [245,250] z.update()
Is this a known bug? Should I be posting to scipy-devel instead? Thanks, Adam
![](https://secure.gravatar.com/avatar/1bc8694bf55c688b2aa2075eedf9b4c6.jpg?s=120&d=mm&r=g)
-----Original Message----- From: scipy-user-admin@scipy.net [mailto:scipy-user-admin@scipy.net] On Behalf Of Adam C. Finnefrock Sent: Tuesday, August 06, 2002 4:22 PM To: scipy-user Subject: [SciPy-user] plt.image: zoom too far?
Hi all,
Has anyone had trouble using plt.image and zooming in too far?
The symptoms are either using all available memory (Linux, > 400MB) or showing a blank white window (Linux, Windows).
Example:
import gui_thread <Importing wxPython... done.> from scipy import *
from scipy import plt img = plt.lena() plt.image(img)
1. Use the mouse, zoom in on the eye near the center of the image. (In linux, python's memory usage peaks and then returns to original value.) 2. Now, zoom in closer using the mouse so that just the iris and
Yep, this is a known bug. The zooming feature relies on wxPython to zoom the image, and it looks like wxPython generates the entire image when scaling it resulting in a memory explosion. This needs reimplementation to solve the problem for images. It doesn't affect scatter plots -- just images. A patch would be very welcomed. :-) Eric pupil
would be shown. (In linux, memory usage rises to > 400MB and this disk starts swapping. In Windows, the image is not rendered but instead a white canvas is shown.)
Same results can be obtained on the command-line:
z=plt.image(img) z.x_axis.bounds = [245,250] z.y_axis.bounds = [245,250] z.update()
Is this a known bug? Should I be posting to scipy-devel instead?
Thanks, Adam _______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
![](https://secure.gravatar.com/avatar/6f6a03895164518b31d9f8d8c133c446.jpg?s=120&d=mm&r=g)
This should not be too hard to fix. I have implemented image zooming on another wxPython plot widget: The original is stored as a wxImage. When zooming, I take a sub-image using the wxImage.GetSubImage() method then rescale the sub-image back up the the desired size using wxImage.Rescale(). I've attached the python file (wxLabPlot.py) if anyone wants to look. It's a crude adaption of the wxPlotCanvas that comes with wxPython. Lines 186->212 deal with the image scaling. If the plt module is written in Python, I could probably write a patch but it will take me a week or two to get round to it. Bryan On Tue, 2002-08-06 at 22:56, eric jones wrote:
Yep, this is a known bug. The zooming feature relies on wxPython to zoom the image, and it looks like wxPython generates the entire image when scaling it resulting in a memory explosion. This needs reimplementation to solve the problem for images. It doesn't affect scatter plots -- just images.
A patch would be very welcomed. :-)
Eric
-----Original Message----- From: scipy-user-admin@scipy.net [mailto:scipy-user-admin@scipy.net] On Behalf Of Adam C. Finnefrock Sent: Tuesday, August 06, 2002 4:22 PM To: scipy-user Subject: [SciPy-user] plt.image: zoom too far?
Hi all,
Has anyone had trouble using plt.image and zooming in too far?
The symptoms are either using all available memory (Linux, > 400MB) or showing a blank white window (Linux, Windows).
Example:
import gui_thread <Importing wxPython... done.> from scipy import *
from scipy import plt img = plt.lena() plt.image(img)
1. Use the mouse, zoom in on the eye near the center of the image. (In linux, python's memory usage peaks and then returns to original value.) 2. Now, zoom in closer using the mouse so that just the iris and pupil would be shown. (In linux, memory usage rises to > 400MB and this disk starts swapping. In Windows, the image is not rendered but instead a white canvas is shown.)
Same results can be obtained on the command-line:
z=plt.image(img) z.x_axis.bounds = [245,250] z.y_axis.bounds = [245,250] z.update()
Is this a known bug? Should I be posting to scipy-devel instead?
Thanks, Adam _______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
![](https://secure.gravatar.com/avatar/1bc8694bf55c688b2aa2075eedf9b4c6.jpg?s=120&d=mm&r=g)
-----Original Message----- From: scipy-user-admin@scipy.net [mailto:scipy-user-admin@scipy.net] On Behalf Of bryan cole Sent: Wednesday, August 07, 2002 4:15 AM To: scipy-user@scipy.net Subject: RE: [SciPy-user] plt.image: zoom too far?
This should not be too hard to fix.
I have implemented image zooming on another wxPython plot widget: The original is stored as a wxImage. When zooming, I take a sub-image using the wxImage.GetSubImage() method then rescale the sub-image back up
Hey Bryan, The entire code base for plt is in python, so hopefully it will be easy for you to patch this in. Thanks, eric the
the desired size using wxImage.Rescale().
I've attached the python file (wxLabPlot.py) if anyone wants to look. It's a crude adaption of the wxPlotCanvas that comes with wxPython. Lines 186->212 deal with the image scaling.
If the plt module is written in Python, I could probably write a patch but it will take me a week or two to get round to it.
Bryan
On Tue, 2002-08-06 at 22:56, eric jones wrote:
Yep, this is a known bug. The zooming feature relies on wxPython to zoom the image, and it looks like wxPython generates the entire image when scaling it resulting in a memory explosion. This needs reimplementation to solve the problem for images. It doesn't affect scatter plots -- just images.
A patch would be very welcomed. :-)
Eric
-----Original Message----- From: scipy-user-admin@scipy.net [mailto:scipy-user-admin@scipy.net] On Behalf Of Adam C. Finnefrock Sent: Tuesday, August 06, 2002 4:22 PM To: scipy-user Subject: [SciPy-user] plt.image: zoom too far?
Hi all,
Has anyone had trouble using plt.image and zooming in too far?
The symptoms are either using all available memory (Linux, > 400MB) or showing a blank white window (Linux, Windows).
Example:
import gui_thread <Importing wxPython... done.> from scipy import *
from scipy import plt img = plt.lena() plt.image(img)
1. Use the mouse, zoom in on the eye near the center of the image. (In linux, python's memory usage peaks and then returns to original value.) 2. Now, zoom in closer using the mouse so that just the iris and pupil would be shown. (In linux, memory usage rises to > 400MB and this disk starts swapping. In Windows, the image is not rendered but instead a white canvas is shown.)
Same results can be obtained on the command-line:
z=plt.image(img) z.x_axis.bounds = [245,250] z.y_axis.bounds = [245,250] z.update()
Is this a known bug? Should I be posting to scipy-devel instead?
Thanks, Adam _______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
![](https://secure.gravatar.com/avatar/db2b8768e55888615195a7492260fd1b.jpg?s=120&d=mm&r=g)
On 06 Aug 2002 17:21:36 -0400 Adam C Finnefrock wrote: Adam> Has anyone had trouble using plt.image and zooming in too far? Adam> The symptoms are either using all available memory (Linux, > Adam> 400MB) or showing a blank white window (Linux, Windows). You are zooming images. The naive approach in plt just scales the whole image up to the necessary resolution. This gets big. Feel free to fix it:)) It should work fine for plots. Greetings, Jochen -- University of North Carolina phone: +1-919-962-4403 Department of Chemistry phone: +1-919-962-1579 Venable Hall CB#3290 (Kenan C148) fax: +1-919-843-6041 Chapel Hill, NC 27599, USA GnuPG key: 44BCCD8E
participants (4)
-
bryan cole
-
eric jones
-
finnefro@sas.upenn.edu
-
Jochen Küpper