diff --git a/fftcg/book.py b/fftcg/book.py index 8de14c5..2a65ffb 100644 --- a/fftcg/book.py +++ b/fftcg/book.py @@ -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) diff --git a/fftcg/imageloader.py b/fftcg/imageloader.py index b5ab73f..27cc0a7 100644 --- a/fftcg/imageloader.py +++ b/fftcg/imageloader.py @@ -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