|
@@ -7,13 +7,19 @@ import PIL.Image
|
|
|
import PIL.ImageOps
|
|
|
|
|
|
|
|
|
-def img_b64_to_arr(img_b64):
|
|
|
+def img_data_to_arr(img_data):
|
|
|
f = io.BytesIO()
|
|
|
- f.write(base64.b64decode(img_b64))
|
|
|
+ f.write(img_data)
|
|
|
img_arr = np.array(PIL.Image.open(f))
|
|
|
return img_arr
|
|
|
|
|
|
|
|
|
+def img_b64_to_arr(img_b64):
|
|
|
+ img_data = base64.b64decode(img_b64)
|
|
|
+ img_arr = img_data_to_arr(img_data)
|
|
|
+ return img_arr
|
|
|
+
|
|
|
+
|
|
|
def img_arr_to_b64(img_arr):
|
|
|
img_pil = PIL.Image.fromarray(img_arr)
|
|
|
f = io.BytesIO()
|