diff --git a/mkimage.py b/mkimage.py index 1446397..e936228 100644 --- a/mkimage.py +++ b/mkimage.py @@ -170,19 +170,34 @@ def create_cover(metadata_dict, image_directory, cover_filename): text_draw = ImageDraw.Draw(img) # these will eventually also become candidates for multilines - text_draw.text((centered(title_text, big_bold_font), 200), title_text, font=big_bold_font, fill=fill_colour_top) - text_draw.text((centered(subtitle_text, medium_font), 350), subtitle_text, font=medium_font, fill=fill_colour_top) - text_draw.text((centered(authors_text, small_font), int(DIMENSIONS[1]/3)-200), authors_text, font=small_font, fill=fill_colour_top) + + # text_draw.text((centered(title_text, big_bold_font), 200), title_text, font=big_bold_font, fill=fill_colour_top) + title_text_lines = textwrap.wrap(title_text, width=30) + title_text_joined = "\n".join(title_text_lines) + ttcenter = centered(title_text_joined, big_bold_font) + text_draw.multiline_text((ttcenter, 200), title_text_joined, font=big_bold_font, align="center") + + if len(subtitle_text) > 0: + text_draw.text((centered(subtitle_text, medium_font), 350), subtitle_text, font=medium_font, fill=fill_colour_top) + + authors_text_lines = textwrap.wrap(authors_text, width=50) + authors_text_joined = "\n".join(authors_text_lines) + ttcenter = centered(authors_text_joined, small_font) + text_draw.multiline_text((ttcenter, int(DIMENSIONS[1]/3)-200), authors_text_joined, font=small_font, align="center") + + # text_draw.text((centered(authors_text, small_font), int(DIMENSIONS[1]/3)-200), authors_text, font=small_font, fill=fill_colour_top) press_text_lines = textwrap.wrap(press_text, width=40) press_text_lines.append(series_number_text) - press_text_joined = "\n".join(press_text_lines) ptcenter = centered(press_text_joined, small_font) text_draw.multiline_text((ptcenter,DIMENSIONS[1]-400), press_text_joined, font=small_font, align="center") - image_on_cover = Image.open(os.path.join(image_directory, get_cover_image(image_directory))) + if image_is_file == False: + image_on_cover = Image.open(os.path.join(image_directory, get_cover_image(image_directory))) + else: + image_on_cover = Image.open(image_directory) MAXIMUM_HEIGHT = 1200