WIP: Integrate with RobotStreamer #5
Binary file not shown.
|
@ -1,8 +1,20 @@
|
||||||
from PIL import Image, ImageDraw
|
import time
|
||||||
|
|
||||||
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
|
|
||||||
|
|
||||||
def testScreen(x=1280, y=720, image=None, stripeList = ["lightgrey", "yellow", "cyan", "lightgreen", "magenta", "red", "blue"]):
|
def testScreen(
|
||||||
if image == None:
|
x=1280, y=720,
|
||||||
|
image=None,
|
||||||
|
stripeList=["lightgrey",
|
||||||
|
"yellow",
|
||||||
|
"cyan",
|
||||||
|
"lightgreen",
|
||||||
|
"magenta",
|
||||||
|
"red",
|
||||||
|
"blue"]):
|
||||||
|
|
||||||
|
if image is None:
|
||||||
image = Image.new("RGB", (x, y))
|
image = Image.new("RGB", (x, y))
|
||||||
|
|
||||||
draw = ImageDraw.Draw(image)
|
draw = ImageDraw.Draw(image)
|
||||||
|
@ -42,5 +54,26 @@ def testScreen(x=1280, y=720, image=None, stripeList = ["lightgrey", "yellow", "
|
||||||
return image
|
return image
|
||||||
|
|
||||||
|
|
||||||
|
def drawText(image):
|
||||||
|
# get a font
|
||||||
|
fnt = ImageFont.truetype("FreeMono.ttf", 50)
|
||||||
|
# get a drawing context
|
||||||
|
d = ImageDraw.Draw(image)
|
||||||
|
|
||||||
|
# draw multiline text
|
||||||
|
d.multiline_text((10, 10), str(time.time()), font=fnt, fill=(0, 0, 0))
|
||||||
|
|
||||||
|
return image
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
testScreen().save('Test-Pattern.png')
|
blank_screen = testScreen()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
annotated_image = drawText(blank_screen.copy())
|
||||||
|
|
||||||
|
annotated_image.save('Test-Pattern.png')
|
||||||
|
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
# testScreen().save('Test-Pattern.png')
|
||||||
|
|
Loading…
Reference in New Issue