From 8e3b3abe8a38aab76dd813c15776e29f154a2689 Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Sat, 21 Aug 2021 16:21:55 -0400 Subject: [PATCH] This testscreen generator works --- companion_software/images/main.py | 37 +++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/companion_software/images/main.py b/companion_software/images/main.py index 75c36bf..a134fee 100644 --- a/companion_software/images/main.py +++ b/companion_software/images/main.py @@ -1,7 +1,7 @@ -import time from PIL import Image, ImageDraw -def testScreen(x=1280, y=720, image=None, stripeList = ["red", "green", "blue", "orange", "purple"]): + +def testScreen(x=1280, y=720, image=None, stripeList = ["lightgrey", "yellow", "cyan", "lightgreen", "magenta", "red", "blue"]): if image == None: image = Image.new("RGB", (x, y)) @@ -12,12 +12,35 @@ def testScreen(x=1280, y=720, image=None, stripeList = ["red", "green", "blue", (x/len(stripeList)) * i, 0, (x/len(stripeList)) * (i + 1), x), fill=stripe) + + draw.rectangle(( + 0, y - (y/3), + x, y), + fill="black") + + for i, stripe in enumerate(stripeList): + if i % 2 != 0: + _fill = "black" + else: + _fill = stripeList[len(stripeList) - i - 1] + + draw.rectangle(( + (x/len(stripeList)) * i, y - (y/3.1), + (x/len(stripeList)) * (i + 1), y - (y/4.9)), + fill=_fill) + + draw.rectangle(( + (x/(len(stripeList)/4)), y - (y/5.3), + (0), y), + fill="darkblue") + + draw.rectangle(( + (x/(len(stripeList)/2)), y - (y/5.3), + (x/(len(stripeList)/1)), y), + fill="white") return image + if __name__ == '__main__': - masterList = ["red", "white", "blue", "green", "orange", "purple", "cyan", "magenta"] - while True: - for i in range(len(masterList)): - testScreen(stripeList=masterList[i:]).save('Test-Pattern.png') - time.sleep(1) + testScreen().save('Test-Pattern.png')