Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
mbwilding committed May 18, 2024
1 parent 061873c commit 18a2aa7
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions generate_showcase.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
"""
This module provides a function to create and save an image with custom text,
and background colors using the Pillow library.
"""
from PIL import Image, ImageDraw, ImageFont

text = """ABCDEFGHIJKLMNOPQRSTUVWXYZ
TEXT = """ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
0123456789
_-~=+*&#$@%^
/<[{(|)}]>\
`'".,:;!?"""

width, height = 3840, 1350
font_path = "NeoSpleen.ttf"
font_size = 294
font = ImageFont.truetype(font_path, font_size)
WIDTH, HEIGHT = 3840, 1350
FONT_PATH = "NeoSpleen.ttf"
FONT_SIZE = 294
FONT = ImageFont.truetype(FONT_PATH, FONT_SIZE)


def create_image(background_color, text_color, file_name):
image = Image.new("RGB", (width, height), background_color)
def create_image(text_color, background_color, file_path):
"""
Create an save an image with specified text color and background color.
Args:
text_color (str): The color of the text in the image.
background_color (str): The background color of the image.
file_path (str): The filename to save the image under.
"""
image = Image.new("RGB", (WIDTH, HEIGHT), background_color)
draw = ImageDraw.Draw(image)
draw.text((0, 0), text, fill=text_color, font=font)
image.save("Showcase-" + file_name)
draw.text((0, 0), TEXT, fill=text_color, font=FONT)
image.save("Showcase-" + file_path)


create_image("black", "white", "WoB.png")
create_image("white", "black", "BoW.png")
create_image("white", "black", "WoB.png")
create_image("black", "white", "BoW.png")

0 comments on commit 18a2aa7

Please sign in to comment.