瀏覽代碼

Fix img_arr_to_b64

Kentaro Wada 1 年之前
父節點
當前提交
2219a1d48f
共有 1 個文件被更改,包括 1 次插入4 次删除
  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