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.

Comments

  1. Marian

    3 years 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

    4 years 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!

    1. cmdr_scotty

      10 months ago

      sudo apt install libpng12-0 got it working for me

  3. Juan

    4 years ago

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

  4. Joh

    5 years ago

    This is broken with the latest version of libpng…

    1. Juan

      4 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!!!