Skip to content

Commit

Permalink
Flip image without modifying attribute when writing PNG
Browse files Browse the repository at this point in the history
  • Loading branch information
naoyak committed Jan 3, 2017
1 parent a4d48d4 commit abcdf28
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/matplotlib/image.py
Expand Up @@ -521,9 +521,8 @@ def contains(self, mouseevent):

def write_png(self, fname):
"""Write the image to png file with fname"""
if self.origin == 'upper':
self._A = self._A[::-1]
im = self.to_rgba(self._A, bytes=True, norm=True)
im = self.to_rgba(self._A[::-1] if self.origin == 'upper' else self._A,
bytes=True, norm=True)
_png.write_png(im, fname)

def set_data(self, A):
Expand Down

0 comments on commit abcdf28

Please sign in to comment.