diff --git a/Makefile b/Makefile index 6833f05..9b3ab4c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ all: rm -rf out||: mkdir out - python3 test.py + python3 generate.py diff --git a/example/0029-Portrait Text-PortraitText-Bold.otf.png b/example/0029-Portrait Text-PortraitText-Bold.otf.png new file mode 100644 index 0000000..1103769 Binary files /dev/null and b/example/0029-Portrait Text-PortraitText-Bold.otf.png differ diff --git a/example/0034-Portrait Text-PortraitTextWeb-Regular.otf.png b/example/0034-Portrait Text-PortraitTextWeb-Regular.otf.png new file mode 100644 index 0000000..f4da384 Binary files /dev/null and b/example/0034-Portrait Text-PortraitTextWeb-Regular.otf.png differ diff --git a/example/0035-Portrait Text-PortraitTextWeb-RegularItalic.otf.png b/example/0035-Portrait Text-PortraitTextWeb-RegularItalic.otf.png new file mode 100644 index 0000000..6523a01 Binary files /dev/null and b/example/0035-Portrait Text-PortraitTextWeb-RegularItalic.otf.png differ diff --git a/example/0036-Portrait Text-PortraitTextWeb-Medium.otf.png b/example/0036-Portrait Text-PortraitTextWeb-Medium.otf.png new file mode 100644 index 0000000..10c29fc Binary files /dev/null and b/example/0036-Portrait Text-PortraitTextWeb-Medium.otf.png differ diff --git a/example/0037-Portrait Text-PortraitTextWeb-HeavyItalic.otf.png b/example/0037-Portrait Text-PortraitTextWeb-HeavyItalic.otf.png new file mode 100644 index 0000000..3ed32f4 Binary files /dev/null and b/example/0037-Portrait Text-PortraitTextWeb-HeavyItalic.otf.png differ diff --git a/example/0038-Portrait Text-PortraitTextWeb-Regular2.otf.png b/example/0038-Portrait Text-PortraitTextWeb-Regular2.otf.png new file mode 100644 index 0000000..92917b7 Binary files /dev/null and b/example/0038-Portrait Text-PortraitTextWeb-Regular2.otf.png differ diff --git a/example/0040-Portrait Inline-PortraitInlineWeb-Regular.otf.png b/example/0040-Portrait Inline-PortraitInlineWeb-Regular.otf.png new file mode 100644 index 0000000..4799370 Binary files /dev/null and b/example/0040-Portrait Inline-PortraitInlineWeb-Regular.otf.png differ diff --git a/example/0042-Portrait Inline-PortraitInline-Regular.otf.png b/example/0042-Portrait Inline-PortraitInline-Regular.otf.png new file mode 100644 index 0000000..cf07521 Binary files /dev/null and b/example/0042-Portrait Inline-PortraitInline-Regular.otf.png differ diff --git a/example/0086-Camcorder-Camcorder-Monospaced-UDon'tKnow.otf.png b/example/0086-Camcorder-Camcorder-Monospaced-UDon'tKnow.otf.png new file mode 100644 index 0000000..3437812 Binary files /dev/null and b/example/0086-Camcorder-Camcorder-Monospaced-UDon'tKnow.otf.png differ diff --git a/example/0087-Camcorder-Camcorder-Monospaced-Outline1.otf.png b/example/0087-Camcorder-Camcorder-Monospaced-Outline1.otf.png new file mode 100644 index 0000000..780b5e1 Binary files /dev/null and b/example/0087-Camcorder-Camcorder-Monospaced-Outline1.otf.png differ diff --git a/example/0088-Camcorder-Camcorder-Monospaced-Regular.otf.png b/example/0088-Camcorder-Camcorder-Monospaced-Regular.otf.png new file mode 100644 index 0000000..03ab599 Binary files /dev/null and b/example/0088-Camcorder-Camcorder-Monospaced-Regular.otf.png differ diff --git a/example/0089-Camcorder-Camcorder-Monospaced-Outline2.otf.png b/example/0089-Camcorder-Camcorder-Monospaced-Outline2.otf.png new file mode 100644 index 0000000..8a4af7c Binary files /dev/null and b/example/0089-Camcorder-Camcorder-Monospaced-Outline2.otf.png differ diff --git a/example/0090-Camcorder-Camcorder-Monospaced-Inverse.otf.png b/example/0090-Camcorder-Camcorder-Monospaced-Inverse.otf.png new file mode 100644 index 0000000..50d1688 Binary files /dev/null and b/example/0090-Camcorder-Camcorder-Monospaced-Inverse.otf.png differ diff --git a/example/0096-Charcuterie-Laura Worthington - CharcuterieBlock-Oblique.otf.png b/example/0096-Charcuterie-Laura Worthington - CharcuterieBlock-Oblique.otf.png new file mode 100644 index 0000000..f2c6845 Binary files /dev/null and b/example/0096-Charcuterie-Laura Worthington - CharcuterieBlock-Oblique.otf.png differ diff --git a/example/0097-Charcuterie-Laura Worthington - CharcuterieBlock-Bold.otf.png b/example/0097-Charcuterie-Laura Worthington - CharcuterieBlock-Bold.otf.png new file mode 100644 index 0000000..08175b3 Binary files /dev/null and b/example/0097-Charcuterie-Laura Worthington - CharcuterieBlock-Bold.otf.png differ diff --git a/example/0105-Alternative files-Laura Worthington - Charcuterie Block Oblique.ttf.png b/example/0105-Alternative files-Laura Worthington - Charcuterie Block Oblique.ttf.png new file mode 100644 index 0000000..adff7a7 Binary files /dev/null and b/example/0105-Alternative files-Laura Worthington - Charcuterie Block Oblique.ttf.png differ diff --git a/example/0107-Alternative files-Laura Worthington - Charcuterie Deco.ttf.png b/example/0107-Alternative files-Laura Worthington - Charcuterie Deco.ttf.png new file mode 100644 index 0000000..c396b13 Binary files /dev/null and b/example/0107-Alternative files-Laura Worthington - Charcuterie Deco.ttf.png differ diff --git a/example/0133-Charcuterie-Laura Worthington - CharcuterieFiligree.otf.png b/example/0133-Charcuterie-Laura Worthington - CharcuterieFiligree.otf.png new file mode 100644 index 0000000..3a59b4c Binary files /dev/null and b/example/0133-Charcuterie-Laura Worthington - CharcuterieFiligree.otf.png differ diff --git a/example/0140-Prohibition-Prohibition Round Oblique.otf.png b/example/0140-Prohibition-Prohibition Round Oblique.otf.png new file mode 100644 index 0000000..a490a71 Binary files /dev/null and b/example/0140-Prohibition-Prohibition Round Oblique.otf.png differ diff --git a/example/0145-Good shit-corporate_gothic_nbp.ttf.png b/example/0145-Good shit-corporate_gothic_nbp.ttf.png new file mode 100644 index 0000000..b9ab3d3 Binary files /dev/null and b/example/0145-Good shit-corporate_gothic_nbp.ttf.png differ diff --git a/example/0276-Dala Moa-DalaMoaBold.otf.png b/example/0276-Dala Moa-DalaMoaBold.otf.png new file mode 100644 index 0000000..698aa6f Binary files /dev/null and b/example/0276-Dala Moa-DalaMoaBold.otf.png differ diff --git a/example/0282-Braxton-Braxton Bold.otf.png b/example/0282-Braxton-Braxton Bold.otf.png new file mode 100644 index 0000000..a3dfbd1 Binary files /dev/null and b/example/0282-Braxton-Braxton Bold.otf.png differ diff --git a/example/0392-Lumin Sans (wf-x)-LuminSans-Hairline.otf.png b/example/0392-Lumin Sans (wf-x)-LuminSans-Hairline.otf.png new file mode 100644 index 0000000..ceea4d0 Binary files /dev/null and b/example/0392-Lumin Sans (wf-x)-LuminSans-Hairline.otf.png differ diff --git a/example/0396-OTF-HYPER DRIVE.otf.png b/example/0396-OTF-HYPER DRIVE.otf.png new file mode 100644 index 0000000..0cdacc6 Binary files /dev/null and b/example/0396-OTF-HYPER DRIVE.otf.png differ diff --git a/example/0419-Might makes-Might Makes .otf.png b/example/0419-Might makes-Might Makes .otf.png new file mode 100644 index 0000000..a5395f9 Binary files /dev/null and b/example/0419-Might makes-Might Makes .otf.png differ diff --git a/example/0628-Lava (wf-x)-LavaMedium.otf.png b/example/0628-Lava (wf-x)-LavaMedium.otf.png new file mode 100644 index 0000000..f8d77ee Binary files /dev/null and b/example/0628-Lava (wf-x)-LavaMedium.otf.png differ diff --git a/example/0638-P22Underground-P22UndergroundCYPro-Medium.otf.png b/example/0638-P22Underground-P22UndergroundCYPro-Medium.otf.png new file mode 100644 index 0000000..fd32b6f Binary files /dev/null and b/example/0638-P22Underground-P22UndergroundCYPro-Medium.otf.png differ diff --git a/example/0639-P22Underground-P22UndergroundCYPro-Book.otf.png b/example/0639-P22Underground-P22UndergroundCYPro-Book.otf.png new file mode 100644 index 0000000..ed89c79 Binary files /dev/null and b/example/0639-P22Underground-P22UndergroundCYPro-Book.otf.png differ diff --git a/example/1191-Accord alternate-AccordAlt_Light.otf.png b/example/1191-Accord alternate-AccordAlt_Light.otf.png new file mode 100644 index 0000000..31dc52d Binary files /dev/null and b/example/1191-Accord alternate-AccordAlt_Light.otf.png differ diff --git a/example/1192-Accord alternate-AccordAlt_Thin.otf.png b/example/1192-Accord alternate-AccordAlt_Thin.otf.png new file mode 100644 index 0000000..7f5ddc9 Binary files /dev/null and b/example/1192-Accord alternate-AccordAlt_Thin.otf.png differ diff --git a/example/1194-Accord alternate-AccordAlt_Regular.otf.png b/example/1194-Accord alternate-AccordAlt_Regular.otf.png new file mode 100644 index 0000000..eecf25f Binary files /dev/null and b/example/1194-Accord alternate-AccordAlt_Regular.otf.png differ diff --git a/example/1196-Accord alternate-AccordAlt_Bold.otf.png b/example/1196-Accord alternate-AccordAlt_Bold.otf.png new file mode 100644 index 0000000..a9caccb Binary files /dev/null and b/example/1196-Accord alternate-AccordAlt_Bold.otf.png differ diff --git a/generate.py b/generate.py index d70b361..7bab204 100644 --- a/generate.py +++ b/generate.py @@ -1,5 +1,5 @@ from PIL import Image, ImageDraw, ImageFont -import subprocess +import subprocess, os, random def getFontName(font, extra = False): result = font.split("/")[-2] if result == "tmp": @@ -8,14 +8,27 @@ def getFontName(font, extra = False): result += "-" + font.split("/")[-1] return result i=0 +word = "The brown fox jumps over the lazy red dog or something" +wordlist = "/usr/share/dict/american-english" null = open("/dev/null", "w") print(" ".join(["find", "/home/niles/Documents/fonts", "-type", "f", "-iregex", ".*\\.ttf|.*\\.otf"])) fonts = subprocess.check_output(["find", "/home/niles/Documents/fonts", "-type", "f", "-iregex", ".*\\.\(ttf\|otf\)"]).decode("utf-8").split("\n")[:-1] i = 0 for font in fonts: i+=1 - print("Generating " + str(i) + getFontName(font, True)) + idx = str(i).zfill(len(str(len(fonts)))) + print("Generating " + idx + getFontName(font, True)) try: + if os.path.exists(wordlist): + word = "" + while len(word) < 8: + wllen = subprocess.check_output(["wc", "-l", wordlist]).decode("utf-8").strip().split()[0] + newword = subprocess.check_output(["bash", "-c", "head -n " + str(random.randint(0,int(wllen))) + " " + wordlist + "|tail -n 1"]).decode("utf-8").strip() + newword = newword[0].upper() + newword[1:] + if '\'' in newword: + continue + word = word + " " + newword + print(word) txt = Image.new('RGBA', (2000, 2400), (211,141,95, 255)) #txt.putpixel((x, y), (255, 127, 42, 255)) d = ImageDraw.Draw(txt) @@ -29,14 +42,14 @@ for font in fonts: fnt = ImageFont.truetype(font, 800) d.text((1500,300), "a", font=fnt, fill=(255,255,255,255)) fnt = ImageFont.truetype(font, 200) - d.text((100,1200), "The brown fox jumps over the lazy red dog or something", font=fnt, fill=(0,0,0,255)) + d.text((100,1200), word, font=fnt, fill=(0,0,0,255)) fnt = ImageFont.truetype(font, 180) d.text((100,1700), "abcdefghijklm", font=fnt, fill=(0,0,0,255)) d.text((100,1900), "nopqrstuvwxyz", font=fnt, fill=(0,0,0,255)) fnt = ImageFont.truetype(font, 250) d.text((450,2100), "0123456789", font=fnt, fill=(255,255,255,255)) out = txt#Image.alpha_composite(base, txt) - out.save("out/" + str(i) + "-" + getFontName(font, True) + ".png") + out.save("out/" + idx + "-" + getFontName(font, True) + ".png") except: import traceback print(traceback.format_exc())