From d5caa113740bff190a4f151788a62d5dd8cd3af7 Mon Sep 17 00:00:00 2001 From: Mohamad Mansour Date: Fri, 22 Oct 2021 15:26:04 +0300 Subject: [PATCH] Update utility.py Added other image formats that are already verified by imghdr. Not sure about "pgm" format? --- ppocr/utils/utility.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ppocr/utils/utility.py b/ppocr/utils/utility.py index 7bb4c906..7d1faa3b 100755 --- a/ppocr/utils/utility.py +++ b/ppocr/utils/utility.py @@ -51,7 +51,7 @@ def get_image_file_list(img_file): if img_file is None or not os.path.exists(img_file): raise Exception("not found any img file in {}".format(img_file)) - img_end = {'jpg', 'bmp', 'png', 'jpeg', 'rgb', 'tif', 'tiff', 'gif', 'GIF'} + img_end = {'jpg', 'bmp', 'png', 'jpeg', 'rgb', 'tif', 'tiff', 'gif', 'GIF','webp','ppm'} if os.path.isfile(img_file) and imghdr.what(img_file) in img_end: imgs_lists.append(img_file) elif os.path.isdir(img_file): @@ -77,4 +77,4 @@ def check_and_read_gif(img_path): frame = cv2.cvtColor(frame, cv2.COLOR_GRAY2RGB) imgvalue = frame[:, :, ::-1] return imgvalue, True - return None, False \ No newline at end of file + return None, False -- GitLab