Skip to content

Commit

Permalink
will leave rescaling image to user. assuming uint8 [0,255] rgb pixel …
Browse files Browse the repository at this point in the history
…data.
  • Loading branch information
seanshahkarami committed Oct 14, 2020
1 parent 6da81fe commit 17a7810
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions waggle/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,7 @@ def convert_numpy_image_to_png(a):
from PIL import Image
from io import BytesIO
import numpy as np

# normalize data to [0, 255]
a = a - a.min()
max = a.max()
if max > 0:
a /= max * 255
a = np.uint8(a)

img = Image.fromarray(a, 'RGB')

img = Image.fromarray(np.uint8(a), 'RGB')
with BytesIO() as buf:
img.save(buf, 'png')
return buf.getvalue()
Expand Down

0 comments on commit 17a7810

Please sign in to comment.