from pathlib import Path from PIL import Image, ImageDraw, ImageFont out = Path(__file__).with_name("thumbnail.png") im = Image.new("RGB", (1200, 630), (12, 23, 37)) d = ImageDraw.Draw(im) font = "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf" bold = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf" small = ImageFont.truetype(font, 25) label = ImageFont.truetype(bold, 30) title = ImageFont.truetype(bold, 81) d.rounded_rectangle((50, 43, 210, 90), radius=17, fill=(30, 84, 75)) d.text((68, 52), "alphaBell", font=small, fill=(86, 221, 193)) d.text((50, 136), "ONE GREEN TEST", font=title, fill=(245, 249, 249)) d.text((50, 239), "CAN LIE.", font=title, fill=(86, 221, 193)) d.text((52, 348), "Five hidden correctness traps in generated code.", font=ImageFont.truetype(font, 31), fill=(184, 204, 215)) labels = ["TAIL", "STRIDE", "OVERFLOW", "ROWS", "ALIAS"] x = 52 for i, text in enumerate(labels): width = d.textbbox((0, 0), text, font=label)[2] + 47 d.rounded_rectangle((x, 460, x + width, 520), radius=16, fill=(26, 51, 68), outline=(64, 119, 108), width=2) d.text((x + 23, 475), text, font=label, fill=(231, 246, 243)) x += width + 13 d.line((52, 563, 1147, 563), fill=(69, 93, 112), width=2) d.text((52, 584), "Pick the second test. See the actual mismatch.", font=small, fill=(151, 181, 194)) im.save(out, optimize=True) print(out, out.stat().st_size)