dudewheresmycode
Posts: 16
Joined: Thu Aug 16, 2012 5:28 am

View Image without XServer

Tue Aug 21, 2012 5:58 am

Hi,

Im struggling with this problem. I'd like to boot my Pi into the command line, (no startx). How can I simply open and display an image on the screen from the command line. Like I can display a video using omxplayer without, the GUI / XServer running.

User avatar
M.M
Posts: 107
Joined: Fri Aug 03, 2012 7:40 am
Location: Hamburg, GER

Re: View Image without XServer

Tue Aug 21, 2012 7:13 am

Hi dudewheresmycode,

still wating for my pi, so I tested all this on a standard Debian. But maybe it works for you , too.

You could use "fbi" (frame buffer image viewer). You simply install it by executing

Code: Select all

apt-get install fbi
Afterwards, you can view images in terminal by typing

Code: Select all

fbi <imagename>
If it gives you an error like "open /dev/fb0: No such file or directory" it means you first have to activate framebuffer output. The following steps may require root privileges (sudo):

( DISCLAIMER: If you wreck your grub it can destroy your system. Watch your step! )

- open "/etc/default/grub" in your editor of choice.
- locate the line that says "GRUB_GFXMODE=640x480"
- uncomment it and enter the screen resolution you want
- save and exit
- open " /etc/grub.d/00_header "
- go to the line that says "set gfxmode={$GRUB_GFXMODE}"
- insert "set gfxpayload=keep" below it
- save and exit
- execute "update-grub"
- reboot

Now, if you try again to view the image with fbi it should work.


Regards
"If people read the FAQs the Qs wouldn't be A F, would they?"

dudewheresmycode
Posts: 16
Joined: Thu Aug 16, 2012 5:28 am

Re: View Image without XServer

Tue Aug 21, 2012 7:41 am

Hey that works pretty well.

Although, doesn't suit my need exactly, as I can't seem to run it from a SSH console or from a script in node.js. Only from the pi console itself.

I get the error:

Code: Select all

Error: Command failed: using "DejaVu Sans Mono-16", pixelsize=16.67 file=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf
ioctl VT_GETSTATE: Invalid argument (not a linux console?)
 stdout:  stderr: using "DejaVu Sans Mono-16", pixelsize=16.67 file=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf
ioctl VT_GETSTATE: Invalid argument (not a linux console?)
Any ideas?

User avatar
M.M
Posts: 107
Joined: Fri Aug 03, 2012 7:40 am
Location: Hamburg, GER

Re: View Image without XServer

Tue Aug 21, 2012 8:13 am

Hi dudewheresmycode,

from the fbi manpage:
fbi also needs access to the linux console (i.e. /dev/ttyN) for sane console switch handling. That is obviously no problem for console logins, but any kind of a pseudo tty (xterm, ssh, screen, ...) will not work.
I do not know very much about Javascript, but as far as I know it runs in its own shell and not directly from tty. So we semm out of luck here. If you want to stick to Javascript, fbi apparently does not do the trick :(

I could only think of three solutions:

- looking fo another image viewer that can handle pseudo tty
- transcribe your JS script to a shell script
- make your script execute fbi in a tty somehow (not even sure this is possible)

I will have a look at one or two of the options. Maybe someone else comes through with a solution in the meantime.

Regards
"If people read the FAQs the Qs wouldn't be A F, would they?"

dudewheresmycode
Posts: 16
Joined: Thu Aug 16, 2012 5:28 am

Re: View Image without XServer

Thu Aug 23, 2012 1:18 am

I should note that `fbi` has been replaced by `fim` which seems to be an updated version of `fbi`.

http://manpages.ubuntu.com/manpages/luc ... fim.1.html

I've found this works over SSH / external scripts. So problem (almost) solved.

I'm looking for a way to boot my Raspberry into CLI (not loading X) and displaying a pretty image on the screen after boot, rather then a login prompt and CLI text. When I display an image to the framebuffer for output, it doesn't remain on the screen. It gets drawn over by the CLI cursor flashing or output from the CLI.

Still tinkering, I'll post progress here as I go.

Thanks for pointing me in the right direction!

mattvenn
Posts: 24
Joined: Wed Jul 25, 2012 9:59 am

Re: View Image without XServer

Wed Feb 27, 2013 4:30 pm

any luck with that pretty picture?

hayderOICO
Posts: 49
Joined: Thu May 09, 2013 3:40 pm

Re: View Image without XServer

Sun Jul 21, 2013 12:36 pm

dudewheresmycode wrote:Hey that works pretty well.

Although, doesn't suit my need exactly, as I can't seem to run it from a SSH console or from a script in node.js. Only from the pi console itself.

I get the error:

Code: Select all

Error: Command failed: using "DejaVu Sans Mono-16", pixelsize=16.67 file=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf
ioctl VT_GETSTATE: Invalid argument (not a linux console?)
 stdout:  stderr: using "DejaVu Sans Mono-16", pixelsize=16.67 file=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf
ioctl VT_GETSTATE: Invalid argument (not a linux console?)
Any ideas?
Hi

I had the same issue over SSH. Since I wanted to use FBI instead of FIM, the solution was thus:

make a shell script on the pi with the following:

filename IMAGE.sh

Code: Select all

#bin/bash
echo | sudo fbi -T 2 IMAGE.jpg
the fbi -T 2 command forces the use of tty2

then you can run it from SSH execution using:

Code: Select all

SSH2.execCommand("nohup ./IMAGE.sh > /dev/null 2>&1")
The above SSH2 command uses nohup and redirect the STDERR messages to dev/null.

I am using an android tablet to send commands to the pi. Its working fine for me.

Return to “Beginners”

Who is online

Users browsing this forum: chrisoh, Google [Bot], kaz69, SkyRise and 42 guests