Skip to content

Commit

Permalink
Merge pull request #423 from Aikhjarto/fix_422
Browse files Browse the repository at this point in the history
don't multiply by 255 is data is already uint8
  • Loading branch information
nschloe committed Jul 24, 2020
2 parents 32a3bb9 + 4972f62 commit da6335a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tikzplotlib/_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def draw_image(data, obj):
img_array = numpy.flipud(img_array)

# Convert mpl image to PIL
image = PIL.Image.fromarray(numpy.uint8(img_array * 255))
if img_array.dtype != numpy.uint8:
img_array = numpy.uint8(img_array * 255)
image = PIL.Image.fromarray(img_array)

# If the input image is PIL:
# image = PIL.Image.fromarray(img_array)
Expand Down

0 comments on commit da6335a

Please sign in to comment.