From df0eee091cd86fe6ce576fdb3814af69c8fb841b Mon Sep 17 00:00:00 2001 From: Erzangel Date: Tue, 23 Jul 2024 17:37:17 +0200 Subject: [PATCH] feat: fix missing img logic, try to occult image overflow --- src/generate_cards_mvp.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/generate_cards_mvp.py b/src/generate_cards_mvp.py index c6e80d8..8cc0626 100644 --- a/src/generate_cards_mvp.py +++ b/src/generate_cards_mvp.py @@ -91,9 +91,9 @@ for card_data in cards: flavor_text_type=None, ) # Check if card image really exists - if not Path(card_skin_data.image_path).exists(): + if not Path(card_skin_data["image_path"].replace("../../", "")).absolute().exists(): print("Missing image for card id: ", card_data["id"], " , using default image") - card_skin_data = "../../img/missing.png" + card_skin_data["image_path"] = "../../img/missing.png" # Create a new SVG drawing output_dir = "output/" + all_skin_data["skin_name"] os.makedirs(output_dir, exist_ok=True) @@ -211,12 +211,16 @@ for card_data in cards: ) ) - d.append(dw.Rectangle(x=0, y=65, width=x_width, height=200)) + # Draw image + d.append(dw.Rectangle(x=1, y=65, width=x_width-2, height=200)) d.append( dw.Image( x=0, y=65, width=x_width, height=200, path=card_skin_data["image_path"] ) ) + d.append(dw.Rectangle(x=2, y=65-1, width=border_width_x-2, height=200+2)) + # d.append(dw.Rectangle(x=0, y=65+1, width=1, height=200+2, fill='white')) + d.append(dw.Rectangle(x=x_width-border_width_x, y=65-1, width=border_width_x-2, height=200+2)) # Draw effects effects = card_data.get("effects")