RaspiPaspi
Posts: 19
Joined: Tue Sep 11, 2012 8:47 am

Command line Image viewer?

Tue Sep 11, 2012 8:53 am

Hi,

I'm new to Linux but I've tried to get-apt some of the available command line image viewers.

The only one that compiled and installed was one called gqview, but it says it can't open a display.

Is there any way to view images in the command line on Rasberry debian?

I would like, for now, for the raspBerry to boot and display a slideshow of animated gifs.

User avatar
Licaon_Kter
Posts: 240
Joined: Wed Sep 05, 2012 10:12 am
Location: Between the keyboard and the chair.

Re: Command line Image viewer?

Tue Sep 11, 2012 9:21 am

1: sudo apt-get install links2
2: links2 -g <picture.jpg> ?

also, FYI, apt-get just downloads the binary pre-compiled packages, you are not compiling anything on you Pi with it.
BFQ+BFS or RT on a RPi? 4'real: https://github.com/licaon-kter/ (source and compiled!)

paulk
Posts: 12
Joined: Wed Jun 27, 2012 10:32 am

Re: Command line Image viewer?

Tue Sep 11, 2012 10:06 am

Also don't forget you still need to run up X to display any graphics. Although you don't need a display manager.

I use "pqiv" to display slide shows of images within a directory, it's pretty simple

To start your slide show when you type "startx" something like this in .xinitrc in your home directory:

#!/bin/bash
exec /usr/bin/pqiv -<bunch of options> <directory or list of files>
#exec startlxde
#exec xinit xbmc-standalone

RaspiPaspi
Posts: 19
Joined: Tue Sep 11, 2012 8:47 am

Re: Command line Image viewer?

Tue Sep 11, 2012 11:23 am

I downloaded and tried to 'make' something called 'image magic'. It didn't work :D

Links2 doesn't seem to work either. If I run it from the command line it says: Initialization error! Cannon open /dev/mem. Error opening /dev/lty0

Although it does run when I just start 'links2', doesn't show images though just dumps them on the screen as ascii.

RaspiPaspi
Posts: 19
Joined: Tue Sep 11, 2012 8:47 am

Re: Command line Image viewer?

Tue Sep 11, 2012 11:29 am

Ah, I see.

Both links2 and gqview work from command line if x is running. That's incredibly slow though and neither displays animated gif images.

And Paul, you say you can startx without actually starting the desktop?

User avatar
RaTTuS
Posts: 10493
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Command line Image viewer?

Tue Sep 11, 2012 11:42 am

/me wonders if omxplayer does stills ?
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
jojopi
Posts: 3085
Joined: Tue Oct 11, 2011 8:38 pm

Re: Command line Image viewer?

Tue Sep 11, 2012 11:51 am

RaspiPaspi wrote:I downloaded and tried to 'make' something called 'image magic'. It didn't work :D
"sudo apt-get install imagemagick" should work. It is a collection of tools for command-line manipulation of images, however. And the "display" program that comes with it requires X.

"sudo apt-get install fbi" will give you an image viewer that works on the framebuffer console.

paulk
Posts: 12
Joined: Wed Jun 27, 2012 10:32 am

Re: Command line Image viewer?

Tue Sep 11, 2012 11:58 am

Yes you can start any random X program, without a window manager, you just don't get any "chrome", (close buttons, windows etc.) it runs full screen.

Look in .xinitrc in your home directory, it's the first file startx looks for when run from the command prompt. It may be running startlxde (if you have that installed).

The example I gave can be used, you just need to modify it to whatever image viewer you use, with command switches etc.

When the program exits, so will X.

RaspiPaspi
Posts: 19
Joined: Tue Sep 11, 2012 8:47 am

Re: Command line Image viewer?

Tue Sep 11, 2012 12:33 pm

Thanks for all your suggestions, great stuff. Appreciate it!

I tried fbi, this would be great... if it supported animated gif.

I installed ristretto. It works in X, plays animated gifs but doesn't remove the mouse pointer in full screen mode.

PQIV has some great options, it just never shows an image for me. For example running "PQIV -f image.jpg" does nothing. Just dumps the help.

Thanks Paul, when I find an image viewer in x that does what I'm looking for I will follow your instructions. I don't see a file called ".xinitrc" in my home folder though. Is it possible I don't have one yet or that it's hidden?

mdewey
Posts: 37
Joined: Wed Dec 07, 2011 10:47 am
Location: UK

Re: Command line Image viewer?

Tue Sep 11, 2012 1:02 pm

RaspiPaspi wrote:Thanks for all your suggestions, great stuff. Appreciate it!

I tried fbi, this would be great... if it supported animated gif.

I installed ristretto. It works in X, plays animated gifs but doesn't remove the mouse pointer in full screen mode.

PQIV has some great options, it just never shows an image for me. For example running "PQIV -f image.jpg" does nothing. Just dumps the help.

Thanks Paul, when I find an image viewer in x that does what I'm looking for I will follow your instructions. I don't see a file called ".xinitrc" in my home folder though. Is it possible I don't have one yet or that it's hidden?
You need to do ls -a to see files which start with a .
Apologies if you already knew that.

Michael

User avatar
Licaon_Kter
Posts: 240
Joined: Wed Sep 05, 2012 10:12 am
Location: Between the keyboard and the chair.

Re: Command line Image viewer?

Tue Sep 11, 2012 1:05 pm

don't compile programs, just install them with sudo apt-get <program name>
links2 -g works as a web browser WITHOUT the X server, and yes it displays pictures

run sudo raspi-config -> choose Start mode -> Graphical and don't mess with .xinitrc
BFQ+BFS or RT on a RPi? 4'real: https://github.com/licaon-kter/ (source and compiled!)

paulk
Posts: 12
Joined: Wed Jun 27, 2012 10:32 am

Re: Command line Image viewer?

Tue Sep 11, 2012 2:54 pm

It's entirely possible .xinitrc doesn't exist, it's not needed if you have a display manager, that start X on boot. It's just a bash script, the following example will start lxde if that is what you want:

Code: Select all

#!/bin/bash
exec startlxde
this will run pqiv as you described above (assuming it works!!)

Code: Select all

#!/bin/bash
exec /usr/bin/pqiv -f image.jpg
Not sure why pqiv doesn't work for you (as printed the command won't work, pqiv needs to be lower case). The fact that it's dumping the help indicates it doesn't understand the options being given to it. I'm assuming you have X running? You installed using apt-get?

Could you post the output of that command here?

RaspiPaspi
Posts: 19
Joined: Tue Sep 11, 2012 8:47 am

Re: Command line Image viewer?

Wed Sep 12, 2012 11:45 am

pqiv -f image.jpg

says : "usage pqiv [options] <files or folders>" and then it just dumps the help.

Maybe it can't find the image file but it's right there in the folder and it displays fine if I type "ristretto image.jpg".

Of course i am interested in playing back animated gifs full screen without clutter. That's why I wanted to do it from the console at first. Ristretto seems to full the display with clutter and buttons so it is not what I am looking for but it shows that the file is there and it can be displayed. Weird that pqiv does nothing but dump the help.

RaspiPaspi
Posts: 19
Joined: Tue Sep 11, 2012 8:47 am

Re: Command line Image viewer?

Wed Sep 12, 2012 11:51 am

And what part of:

"
#!/bin/bash
exec startlxde
"

do I type in to the console?

Or do I need to put that in this x init file? And what does it do? Start x but without the display (the icons and so on?).

j3r
Posts: 8
Joined: Wed Sep 12, 2012 7:53 pm

Re: Command line Image viewer?

Wed Sep 12, 2012 7:55 pm

I am also trying to get a light slideshow set up, pqiv looks awesome, but it just dumps the help file whenever it is invoked. I have no clue what could be wrong, I am in the dir with my images, I used

/usr/bin/pqiv 46.jpg

and I get

usage: pqiv [options] <files or folders>

It has to be a bug.

mebepi
Posts: 84
Joined: Thu Aug 02, 2012 10:32 pm

Re: Command line Image viewer?

Thu Sep 13, 2012 8:20 am

If you are in the folder where the image is the right syntax is:

Code: Select all

/usr/bin/pqiv ./46.jpg
The ./ before the filename states that it has to look for the file in the current directory.
Or try to specify the full path to the file.

Give it a try.

RaspiPaspi
Posts: 19
Joined: Tue Sep 11, 2012 8:47 am

Re: Command line Image viewer?

Thu Sep 13, 2012 8:30 am

@ mebepi that doesn't work either, pqiv just dumps the help.

Pretty bizarre.

paulk
Posts: 12
Joined: Wed Jun 27, 2012 10:32 am

Re: Command line Image viewer?

Thu Sep 13, 2012 8:38 am

How did you install pqiv?

Link for background on .xinitrc

https://wiki.archlinux.org/index.php/Xinitrc

j3r
Posts: 8
Joined: Wed Sep 12, 2012 7:53 pm

Re: Command line Image viewer?

Thu Sep 13, 2012 2:10 pm

I tried pretty much everything with pqiv. Giving it a directory, giving it a *.jpg, a full path, whatever. I installed it with apt-get. I am a long-time linux user and I am pretty sure a ./ is assumed when giving just a filename, but even if not a full path like /home/pi/Wallpapers/46.jpg also just dumps the help file. What I am not sure of is whose package this is, who do I file a bug with?

paulk
Posts: 12
Joined: Wed Jun 27, 2012 10:32 am

Re: Command line Image viewer?

Thu Sep 13, 2012 7:19 pm

I've tracked down what's happening with pqiv, for some reason on armhf/raspbian, it's mis-counting the number of options on the command line and and in the last loop through the getopts/case statement it has no argument, triggers the help and exits!

If someone wants to recompile the package (I don't have a pi I'm doing this on a 'true' armhf debian system), I can probably give them a quick and dirty patch.

j3r
Posts: 8
Joined: Wed Sep 12, 2012 7:53 pm

Re: Command line Image viewer?

Thu Sep 13, 2012 7:55 pm

I can do this, I just compiled from source and the error still persists. I have no c knowledge though, so if you can come up with a patch I will compile and test it.

j3r
Posts: 8
Joined: Wed Sep 12, 2012 7:53 pm

Re: Command line Image viewer?

Thu Sep 13, 2012 8:10 pm

I still want to get pqiv working, but in case anyone is looking for a simple way to make a slideshow/view images - try out fbi (sudo apt-get install fbi) (there is also fim but I have yet to test this) - it displays images direct to the framebuffer and therefore does not need X running. It is quite simple, no effects really, but it works well and uses very little resources.

paulk
Posts: 12
Joined: Wed Jun 27, 2012 10:32 am

Re: Command line Image viewer?

Thu Sep 13, 2012 8:17 pm

looking slightly more complex, so this might not work, worth a try though:

in pqiv.c find the bit that looks like

Code: Select all

                        case 'h':
                        default:
                               helpMessage(0);
change to

Code: Select all

                        case 'h':
                       /* default: */
                               helpMessage(0);
(basically comment out the default argument).This should stop the help message triggering, and force the program to run.

You can do all this from within the pqiv directory, just make (or make debug /make vdebug for more messages) and run from there.

Something weird is happening, compiling the same code on x86 works fine, even with the miscounted arguments. The code isn't that low-level, so I don't think it's doing anything that *should* be architecture specific, but like you I am right at the edge of my C knowledge. Fun-times!

I wish I had a regular debian arm file-system to try this on, to rule out the hf aspect. If anyone has an SD card with a regular debian on it's probably worth installing pqiv on that and trying it.

j3r
Posts: 8
Joined: Wed Sep 12, 2012 7:53 pm

Re: Command line Image viewer?

Thu Sep 13, 2012 8:30 pm

paulk wrote:looking slightly more complex, so this might not work, worth a try though:
With that line commented out pqiv just hangs using all available CPU. Quite strange.

nadir
Posts: 112
Joined: Sun Jun 10, 2012 5:45 am

Re: Command line Image viewer?

Fri Sep 14, 2012 3:00 am

jojopi wrote:
RaspiPaspi wrote: "sudo apt-get install fbi" will give you an image viewer that works on the framebuffer console.
I couldn't figure out how to enable framebuffer. Is there a how-to somewhere?

Return to “Raspbian”