Browse Source

Fix img_arr_to_b64

Kentaro Wada 1 year ago
parent
commit
2219a1d48f
1 changed files with 1 additions and 4 deletions
  1. 1 4
      labelme/utils/image.py

+ 1 - 4
labelme/utils/image.py

@@ -35,10 +35,7 @@ def img_pil_to_data(img_pil):
 
 def img_arr_to_b64(img_arr):
     img_data = img_arr_to_data(img_arr)
-    if hasattr(base64, "encodebytes"):
-        img_b64 = base64.encodebytes(img_data)
-    else:
-        img_b64 = base64.encodestring(img_data)
+    img_b64 = base64.b64encode(img_data).decode("utf-8")
     return img_b64