Merge pull request #20 from MalOMaw/main
add support for jpeg, less ambigious extension list
This commit is contained in:
commit
836aba548d
|
@ -13,6 +13,8 @@ from tkinter import filedialog
|
|||
from PIL import Image, ImageTk
|
||||
from pathlib import Path
|
||||
|
||||
IMG_EXT = ["jpg", "jpeg", "png"]
|
||||
|
||||
class CaptionedImage():
|
||||
def __init__(self, image_path):
|
||||
self.base_path = image_path.parent
|
||||
|
@ -67,7 +69,8 @@ class ImageView(tk.Frame):
|
|||
if self.base_path is None:
|
||||
return
|
||||
self.images.clear()
|
||||
for file in self.base_path.glob('*.[jp][pn][gg]'): # jpg or png
|
||||
for ext in IMG_EXT:
|
||||
for file in self.base_path.glob(f'*.{ext}'):
|
||||
self.images.append(CaptionedImage(file))
|
||||
self.images.sort()
|
||||
self.update_ui()
|
||||
|
|
Loading…
Reference in New Issue