Permalink
Browse files

Merge pull request #1770 from dhyams/wxbackend_tiff_jpeg_pil_fix

strange output from wx and wxagg when trying to render to JPEG or TIFF
  • Loading branch information...
2 parents fdf123e + 9192c2e commit 3b2a722fffde40c19d67242120ccd0306784fb8b @mdboom mdboom committed May 13, 2013
Showing with 9 additions and 6 deletions.
  1. +9 −6 lib/matplotlib/backends/backend_wx.py
@@ -128,6 +128,7 @@ def bind(actor,event,action,id=None):
FigureCanvasBase, FigureManagerBase, NavigationToolbar2, \
cursors, TimerBase
from matplotlib.backend_bases import ShowBase
+from matplotlib.backend_bases import _has_pil
from matplotlib._pylab_helpers import Gcf
from matplotlib.artist import Artist
@@ -1133,19 +1134,21 @@ def print_figure(self, filename, *args, **kwargs):
def print_bmp(self, filename, *args, **kwargs):
return self._print_image(filename, wx.BITMAP_TYPE_BMP, *args, **kwargs)
- def print_jpeg(self, filename, *args, **kwargs):
- return self._print_image(filename, wx.BITMAP_TYPE_JPEG, *args, **kwargs)
- print_jpg = print_jpeg
+ if not _has_pil:
+ def print_jpeg(self, filename, *args, **kwargs):
+ return self._print_image(filename, wx.BITMAP_TYPE_JPEG, *args, **kwargs)
+ print_jpg = print_jpeg
def print_pcx(self, filename, *args, **kwargs):
return self._print_image(filename, wx.BITMAP_TYPE_PCX, *args, **kwargs)
def print_png(self, filename, *args, **kwargs):
return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs)
- def print_tiff(self, filename, *args, **kwargs):
- return self._print_image(filename, wx.BITMAP_TYPE_TIF, *args, **kwargs)
- print_tif = print_tiff
+ if not _has_pil:
+ def print_tiff(self, filename, *args, **kwargs):
+ return self._print_image(filename, wx.BITMAP_TYPE_TIF, *args, **kwargs)
+ print_tif = print_tiff
def print_xpm(self, filename, *args, **kwargs):
return self._print_image(filename, wx.BITMAP_TYPE_XPM, *args, **kwargs)

0 comments on commit 3b2a722

Please sign in to comment.