Loads a png image file and display it as a Dispmanx layer.

Installing raspidmx

raspidmx is a library created by AndrewFromMelbourne that leaverages some of the capabilities of the Dispmanx API.  Its a great starting point for anyone wishing to learn the Dispmanx API which is very poorly documented.

See the library homepage at https://github.com/AndrewFromMelbourne/raspidmx

Copy the entire folder onto the pi, say into /home/pi/raspidmx/

Look for the README.md note re building, currently:

You will need to install libpng before you build the program. On Raspbian
sudo apt-get install libpng12-dev


cd /home/pi/raspidmx

Then


sudo make

 

Using

Usage: pngview [-b ] [-d ] [-l ] [-x ] [-y ] <file.png>

-b – set background colour 16 bit RGBA
     e.g. 0x000F is opaque black
-d – Raspberry Pi display number
-l – DispmanX layer number
-x – offset (pixels from the left)
-y – offset (pixels from the top)


	//If pngview is in the same directory as us:
	./pngview -b 0 -l 3 /home/pi/camerarecord/image1.png &		#Transparent background (-b), Layer 3 (-l)

	//If pngview is elsewhere:
	/home/pi/raspidmx/pngview/pngview -b 0 -l 3 /home/pi/camerarecord/image1.png &	#Transparent background (-b), Layer 3 (-l)
	
	//To clear images:
	sudo killall pngview

Issues

There are limitations on how many images can be displayed.  2 at once seems OK, above this may cause problems.  See thread here.

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.