Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm looking for an image viewer that takes data on stdin and can be run like:

cat image.png | imageviewer
share|improve this question

4 Answers

ImageMagick's display program will do just that, assuming you pipe it something that it understands.

cat image.png | display

and it'll pop up a window showing that image.

share|improve this answer

ImageMagick's display.

display < foo.png
share|improve this answer

On Linux (and likely BSDs), almost all of them – if you give /dev/stdin as the path. This includes: xloadimage, feh, Eye of GNOME (eog).

eog /dev/stdin < "$file"

(Not all of them work well with special files, though. GThumb failed the test, for example.)

share|improve this answer
1  
This doesn't work: cat graph.png | eog /dev/stdin – bukzor Apr 13 '11 at 16:03
If we know "$file", i think we can issue eog "$file".Am I missing something? – Naga Kiran Jun 20 '11 at 18:27
2  
@Naga: The < "$file" was an example. The point was whether the program can accept an arbitrary stream, be it a simple redirection or something more advanced (such as providing an image via stdin, a named pipe, process substitution, a socket, or a character device). The problem is that many viewers require the fd to be seekable, which only regular files and block devices are. – grawity Jun 20 '11 at 18:56
2  
As @bukzor pointed out, cat graph.png | eog /dev/stdin fails, but eog /dev/stdin < graph.png works. – Denilson Sá Jan 3 '12 at 17:18
Is there any way to make this method work with piping (|) as well? – Tarrasch May 12 '12 at 16:05

A FIFO could work with eog's lack of piping support:

mkfifo ${tmpfilename};
cat ${file} > ${tmpfilename} &;
eog /dev/stdin < ${tmpfilename};
rm ${tmpfilename};

AFAIK this should work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.