From 8ab95e252fdb246746f77ae8d7fe628b218f8730 Mon Sep 17 00:00:00 2001 From: Flo Greistorfer Date: Mon, 8 Jul 2024 12:06:54 +0200 Subject: [PATCH] changed dimension getting (hopefully faster now) --- builder.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/builder.py b/builder.py index 38e0138..47ef092 100755 --- a/builder.py +++ b/builder.py @@ -169,14 +169,15 @@ def list_folder(folder: str, title: str) -> None: contains_files = True if extsplit[1].lower() in args.file_extensions: with Image.open(os.path.join(folder, item)) as img: - image = { - "url": f"{args.web_root_url}{baseurl}{urllib.parse.quote(item)}", - "thumbnail": f"{args.web_root_url}.thumbnails/{baseurl}{urllib.parse.quote(extsplit[0])}.jpg", - "name": item, - "width": img.width, - "height": img.height, - } + width, height = img.size img.close() + image = { + "url": f"{args.web_root_url}{baseurl}{urllib.parse.quote(item)}", + "thumbnail": f"{args.web_root_url}.thumbnails/{baseurl}{urllib.parse.quote(extsplit[0])}.jpg", + "name": item, + "width": width, + "height": height, + } if not os.path.exists(os.path.join(args.root_directory, ".thumbnails", foldername, item)): thumbnails.append((folder, item)) for raw in RAW_EXTENSIONS: