I'm using the Python script example from the Raspberry PiCamera site here to display a 'lower third' graphic over the video camera display. Then I plan to capture that HDMI video (HDMI to USB adapter) and use it during video meetings (Zoom, Google Meet, etc.).
What I want to do is to have the script update the image without restarting the script. It could just be every couple seconds or it could watch the file and when it changes, reload it.
Here's the script as it stands now. I'm not a Python expert so I thought I would come here. Thanks!
import picamera
from PIL import Image
from time import sleep
with picamera.PiCamera() as camera:
camera.start_preview()
img = Image.open('lol.gif')
pad = Image.new('RGBA', (
((img.size[0] + 31) // 32) * 32,
((img.size[1] + 15) // 16) * 16,
))
pad.paste(img, (0, 0), img)
o = camera.add_overlay(pad.tostring(), size=img.size)
o.alpha = 255
o.layer = 3
while True:
sleep(1)