How can i create preferably dynamic overlays using Dispmanx in Python on a Raspberry Pi (3B)?

My goal is to overlay custom images containing current information on top of a Picamera Preview. The Picamera module provides a similar functionality, which i got to work in low resolution with only 4 fps (low fps due to constantly adding and removing 2 overlays and alternately hiding them below the layer of the Picamera preview)

I am aware of C programs (AndrewFromMelbourne on Github) which use Dispmanx do generate these overlays very fast.

A Python implementation of overlays in pi3d module does not work with transparency.

Bind pygame surface to dispmanx element

In the question quoted above, the user managed to create dispmanx elements via python, I would like to know how to do exactly this. Thank you.

1 Answer 1


This is probably well after the horse has bolted but in pi3d have you tried use_glx=True argument in Display.create() I'm assuming here that you have set the graphics driver to fake KMS and you're running the x-server. If running the legacy graphics driver then pi3d should render over the top of the dispmanx layer. I think!

The display background needs alpha 0.0 and if using the x-server you need to start the compositor (xcompmgr either from command line or might be something in raspi-config)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.