Skip to content

Commit a20cf6d

Browse files
committed
apperently the failure with flipped .png file is fixed in matplotlib now, so we can get rid of numpy.flipud() before imsave()
1 parent a7a314e commit a20cf6d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

matplotlib2tikz/image.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ def draw_image(data, obj):
2727
# store the image as in a file
2828
img_array = obj.get_array()
2929

30-
if obj.origin == "lower":
31-
img_array = numpy.flipud(img_array)
32-
3330
dims = img_array.shape
3431
if len(dims) == 2: # the values are given as one real number: look at cmap
3532
clims = obj.get_clim()
@@ -45,6 +42,8 @@ def draw_image(data, obj):
4542
# RGB (+alpha) information at each point
4643
assert len(dims) == 3 and dims[2] in [3, 4]
4744
# convert to PIL image
45+
if obj.origin == "lower":
46+
img_array = numpy.flipud(img_array)
4847
image = PIL.Image.fromarray(img_array)
4948
image.save(filename, origin=obj.origin)
5049

0 commit comments

Comments
 (0)