From 17a78108ea2422f571d6dd707cfa0e5fc5efabe0 Mon Sep 17 00:00:00 2001 From: Sean Shahkarami Date: Wed, 14 Oct 2020 16:39:01 -0500 Subject: [PATCH] will leave rescaling image to user. assuming uint8 [0,255] rgb pixel data. --- waggle/plugin.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/waggle/plugin.py b/waggle/plugin.py index d04cabb..e1aac77 100644 --- a/waggle/plugin.py +++ b/waggle/plugin.py @@ -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()