fix issue 2086

This commit is contained in:
LDOUBLEV 2021-03-04 19:57:21 +08:00
parent 45111a7b46
commit 6bd6bee58f
1 changed files with 4 additions and 4 deletions

View File

@ -50,15 +50,15 @@ 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'}
if os.path.isfile(img_file) and os.path.splitext(img_file)[-1][
1:] in img_end:
img_end = {'jpg', 'bmp', 'png', 'jpeg', 'rgb', 'tif', 'tiff', 'gif'}
if os.path.isfile(img_file) and os.path.splitext(img_file)[-1][1:].lower(
) in img_end:
imgs_lists.append(img_file)
elif os.path.isdir(img_file):
for single_file in os.listdir(img_file):
file_path = os.path.join(img_file, single_file)
if os.path.isfile(file_path) and os.path.splitext(file_path)[-1][
1:] in img_end:
1:].lower() in img_end:
imgs_lists.append(file_path)
if len(imgs_lists) == 0:
raise Exception("not found any img file in {}".format(img_file))