Skip to content

πŸ“„ Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.

fix: fixed issue #528

SWHLa0bb926500a4
diff --git a/python/rapidocr/utils/utils.py b/python/rapidocr/utils/utils.py
index 842fa78..80ca84d 100644
--- a/python/rapidocr/utils/utils.py
+++ b/python/rapidocr/utils/utils.py
@@ -4,6 +4,7 @@
import hashlib
import importlib
from pathlib import Path
+from sys import platform
from typing import Tuple, Union
from urllib.parse import urlparse
@@ -44,6 +45,10 @@ def save_img(save_path: Union[str, Path], img: np.ndarray):
if not Path(save_path).parent.exists():
Path(save_path).parent.mkdir(parents=True, exist_ok=True)
+ if platform.startswith("win32"):
+ cv2.imencode(Path(save_path).suffix, img)[1].tofile(str(save_path))
+ return
+
cv2.imwrite(str(save_path), img)