1
0
Fork 0
mirror of https://github.com/ldericher/fftcgtool synced 2025-01-15 15:02:59 +00:00

Minor Cleanup

This commit is contained in:
Jörn-Michael Miehe 2021-08-04 20:15:38 +02:00
parent b4a690d84e
commit 0379ed074a
2 changed files with 6 additions and 2 deletions

View file

@ -19,7 +19,6 @@ class Book:
logger = logging.getLogger(__name__)
images = ImageLoader.load(cards, resolution, language, num_threads)
images = [images[card] for card in cards]
# shorthands
# rows and columns per sheet
@ -34,7 +33,7 @@ class Book:
for i, image in enumerate(images):
x, y = (i % c) * w, (i // c) * h
page.paste(image, (x, y, x + w, y + h))
page.paste(image, (x, y))
self.__pages.append(page)

View file

@ -35,6 +35,8 @@ class ImageLoader(threading.Thread):
try:
res = requests.get(ImageLoader.__FACE_URL.format(card.code, self.__language))
image = Image.open(io.BytesIO(res.content))
# unify images
image.convert("RGB")
image = image.resize(self.__resolution, Image.BICUBIC)
break
@ -65,6 +67,9 @@ class ImageLoader(threading.Thread):
for loader in loaders:
images = {**images, **loader.images}
# sort images to match the initial "cards" list
images = [images[card] for card in cards]
return images
@property