Revision: 7484
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7484&view=rev
Author: efiring
Date: 2009-08-14 01:58:44 +0000 (Fri, 14 Aug 2009)
Log Message:
-----------
Prevent exception when image is off screen and out of the axes.
Bug reported by G. Jones.
Modified Paths:
--------------
branches/v0_99_maint/lib/matplotlib/image.py
Modified: branches/v0_99_maint/lib/matplotlib/image.py
===================================================================
--- branches/v0_99_maint/lib/matplotlib/image.py 2009-08-14 00:49:02 UTC
(rev 7483)
+++ branches/v0_99_maint/lib/matplotlib/image.py 2009-08-14 01:58:44 UTC
(rev 7484)
@@ -202,6 +202,8 @@
# image input dimensions
im.reset_matrix()
numrows, numcols = im.get_size()
+ if numrows < 1 or numcols < 1: # out of range
+ return None
im.set_interpolation(self._interpd[self._interpolation])
@@ -233,6 +235,8 @@
self.axes.get_yscale() != 'linear'):
warnings.warn("Images are not supported on non-linear axes.")
im = self.make_image(renderer.get_image_magnification())
+ if im is None: # out of range
+ return
im._url = self.get_url()
l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds
clippath, affine = self.get_transformed_clip_path_and_affine()
@@ -265,6 +269,8 @@
def write_png(self, fname, noscale=False):
"""Write the image to png file with fname"""
im = self.make_image()
+ if im is None: # out of range
+ return
if noscale:
numrows, numcols = im.get_size()
im.reset_matrix()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins