akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

RaspberryPi, Display Image from Command line on HDMI Port

Sun Apr 30, 2017 6:11 am

Please advise command line image viewer for Raspberry Pi, that will display image on HDMI port.

User avatar
rpdom
Posts: 15005
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: RaspberryPi, Display Image from Command line on HDMI Por

Sun Apr 30, 2017 6:55 am

fbi - Linux frame buffer image view should work for a start, but if you are keen you can look at the source of the hello_jpeg example program in /opt/vc/src/hello_pi/hello_jpeg

akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

Re: RaspberryPi, Display Image from Command line on HDMI Por

Sun Apr 30, 2017 9:54 am

it giving below error, I have check /usr/bin and other directories I do not have lilclient. Kindly advise from where I will get that??

cc -DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -Wall -g -DHAVE_LIBOPENMAX=2 -DOMX -DOMX_SKIP64BIT -ftree-vectorize -pipe -DUSE_EXTERNAL_OMX -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM -Wno-psabi -I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -I./ -I../libs/ilclient -I../libs/vgfont -g -c jpeg.c -o jpeg.o -Wno-deprecated-declarations
cc -o hello_jpeg.bin -Wl,--whole-archive jpeg.o -lilclient -L/opt/vc/lib/ -lGLESv2 -lEGL -lopenmaxil -lbcm_host -lvcos -lvchiq_arm -lpthread -lrt -lm -L../libs/ilclient -L../libs/vgfont -Wl,--no-whole-archive -rdynamic
/usr/bin/ld: cannot find -lilclient
collect2: error: ld returned 1 exit status
../Makefile.include:19: recipe for target 'hello_jpeg.bin' failed
make: *** [hello_jpeg.bin] Error 1
rm jpeg.o

User avatar
rpdom
Posts: 15005
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: RaspberryPi, Display Image from Command line on HDMI Por

Sun Apr 30, 2017 11:38 am

Sorry, I should have mentioned that you have to build a couple of library files first. The instructions are in /opt/vc/src/hello_pi/README

Code: Select all

Building on Pi
++++++++++++++

To build the test apps on the pi, first build the libs:
make -C libs/ilclient
make -C libs/vgfont

then by entering each test app directory and run make. E.g.
  cd hello_world
  make
  ./hello_world.bin

Running ./rebuild.sh will rebuild the all libs and and apps.

akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

Re: RaspberryPi, Display Image from Command line on HDMI Por

Sun Apr 30, 2017 12:02 pm

Thanks for your prompt response.
After executing commands as you advise, it successfully build binary. When I am trying to display images it is given below error
Please advise further on this. In addition, also advise soem command line image viewer for raspberry pi as well

pi@zabbix_temp /opt/vc/src/hello_pi/hello_jpeg
╰─$ ls
hello_jpeg.bin jpeg.c jpeg.h Makefile test.png
╭─pi@zabbix_temp /opt/vc/src/hello_pi/hello_jpeg
╰─$ ./hello_jpeg.bin test.png
Did not receive executing stat -1
No EOS event on image decoder -1
No EOS event on image resizer -1
╭─pi@zabbix_temp /opt/vc/src/hello_pi/hello_jpeg

User avatar
rpdom
Posts: 15005
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: RaspberryPi, Display Image from Command line on HDMI Por

Sun Apr 30, 2017 1:32 pm

Hmm, I've had hello_jpeg working before. It has some advantages like it is small, uses the hardware image decoder so the cpu has very little work to do, and displays the image on a new video layer, hiding the screen text behind it. I don't know why it isn't working here (I've tried it with a jpeg as well as png file).

It looks like you might be better off installing fbi which uses the Linux frame buffer video layer, the same as the console text does. It has a lot more options, some of which may need setting.

Running from the console, I used

Code: Select all

fbi --autozoom --noverbose test.png
and to display on the Pi while logged in via ssh, I used

Code: Select all

sudo fbi --autozoom --noverbose --vt 1 test.png
--autozoom to resize my 640x480 image to fit the screen
--noverbose to get rid of the status line at the bottom of the screen

--vt 1 to display on the tty frame buffer
sudo because as I was logged in remotely I wasn't the owner of tty1 and otherwise wouldn't have permissions to write to it.

The image will display until a key is pressed, but a timeout can be set (--timeout secs)

akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

Re: RaspberryPi, Display Image from Command line on HDMI Por

Sun Apr 30, 2017 2:23 pm

sudo fbi --autozoom --noverbose --vt 1 test.png
sudo: fbi: command not found

Unable to install fbi... please find below error message. Please advise to solve the issue

sudo apt-get install fbi 1 ↵
Reading package lists... 6%
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libftdi1
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
ghostscript gsfonts
Suggested packages:
imagemagick ghostscript-x
The following NEW packages will be installed:
fbi ghostscript gsfonts
0 upgraded, 3 newly installed, 0 to remove and 79 not upgraded.
Need to get 83.2 kB/3,501 kB of archives.
After this operation, 4,978 kB of additional disk space will be used.
0% [Connecting to mirrordirector.raspbian.org]y
Err http://mirrordirector.raspbian.org/raspbian/ jessie/main ghostscript armhf 9.06~dfsg-2+deb8u1
404 Not Found [IP: 93.93.128.193 80]
E: Failed to fetch http://mirrordirector.raspbian.org/rasp ... _armhf.deb 404 Not Found [IP: 93.93.128.193 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

User avatar
rpdom
Posts: 15005
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: RaspberryPi, Display Image from Command line on HDMI Por

Sun Apr 30, 2017 2:48 pm

akhter.ahmed wrote:E: Unable to fetch some archives, maybe run apt-get update
This is telling what needs doing. It's best to always run apt-get update to make sure your local package indexes are up to date before running most other apt-get operations.

Your system is looking for ghostscript 9.06~dfsg-2+deb8u1 but that has been superseded by ghostscript 9.06~dfsg-2+deb8u5

akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

Re: RaspberryPi, Display Image from Command line on HDMI Por

Sun Apr 30, 2017 3:02 pm

After running updates fbi installed but still Raspberry Pi is not displaying images on screen attached with it. Please advise further

╭─pi@zabbix_temp /opt/vc/src/hello_pi/hello_jpeg
╰─$ sudo fbi --autozoom --noverbose --vt 1 test.png
using "DejaVu Sans Mono-16", pixelsize=16.67 file=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf
╭─pi@zabbix_temp /opt/vc/src/hello_pi/hello_jpeg
╰─$ fbi --autozoom --noverbose test.png
using "DejaVu Sans Mono-16", pixelsize=16.67 file=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf
ioctl VT_GETSTATE: Inappropriate ioctl for device (not a linux console?)

User avatar
rpdom
Posts: 15005
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: RaspberryPi, Display Image from Command line on HDMI Por

Sun Apr 30, 2017 3:16 pm

That first option should have displayed the image on the console.

I assume that you have got the console displaying on your HDMI screen, right?

akhter.ahmed
Posts: 21
Joined: Tue Apr 11, 2017 3:22 pm

Re: RaspberryPi, Display Image from Command line on HDMI Por

Sun Apr 30, 2017 3:38 pm

Below command is displaying images on HDMI screen, Thanks for your support & time
sudo fbi -T 2 test.png

User avatar
rpdom
Posts: 15005
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: RaspberryPi, Display Image from Command line on HDMI Por

Sun Apr 30, 2017 5:15 pm

Ah, of course. You're running a desktop/GUI which displays on tty2. I don't have a desktop on my Pi, so I just get the text console on tty1.

Return to “General discussion”