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.

Comments

  1. Marian

    8 months ago

    This is so disapointing to see nobody bothers to update it and keep it working for Rpi4. I know it’s for free, but… how hard can it be? Or at least make a comercial version and keep it updated.

  2. Brynn Rogers

    1 year ago

    there is no libpng12-dev to install. same problem for me, the latest libpng-dev is missing stuff this wants.
    my Pi 3 stuff works, but now the Pi 4 I can’t get pngview to compile which I depend on!

  3. Juan

    2 years ago

    Cannot compile under the latest libpng-dev. There is absolutely NO backward compatibility! Do these developers intentionally do this?

  4. Joh

    2 years ago

    This is broken with the latest version of libpng…

    1. Juan

      2 years ago

      “undefined reference to `png_write_row'””

      What’s so hard about maintaining backward compatibility with this? I’m beginning to wonder if this is a conspiracy!!!

Leave a Reply to Joh Cancel reply

Your email address will not be published. Required fields are marked *