diff --git a/books.py b/books.py index 8b56fa9..a2c4587 100644 --- a/books.py +++ b/books.py @@ -1,6 +1,6 @@ from asyncio import gather, get_event_loop, run from functools import partial, wraps -from os import makedirs +from os import makedirs, path from typing import List from PIL import Image @@ -58,6 +58,9 @@ class MyChapter(Chapter): for img in self.etree.xpath(".//img"): if img.attrib["src"].startswith("http"): img.getparent().remove(img) + else: + image = Image.open(f"{path.dirname(image_dir)}/{img.attrib['src']}") + image.thumbnail((1000, 2000)) def async_wrap(func):