46

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

cat image.png | imageviewer
Mechanical snail
  • 7,963
  • 5
  • 48
  • 67
SL9
  • 461
  • 1
  • 4
  • 3

7 Answers7

60

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.

erjiang
  • 777
16

ImageMagick's display.

display < foo.png
9

You can use feh, it's pretty fast.

cat image.png | feh --scale-down -  

feh is a lightweight image viewer which is in the default repositories of many Linux distributions. It is especially aimed at command line users who need a fast image viewer without huge GUI dependencies.

karel
  • 13,706
MaikoID
  • 284
  • 4
  • 10
8

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.)

grawity
  • 501,077
4

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.

0

With imv, e.g. on Debian bullseye:

sudo apt install imv

it provides commands imv-x11 and imv-wayland

e.g. with imv-x11, pipe to imv-x11, and make sure to end the command with a dash: e.g.

systemd-analyze plot | imv-x11 -

"systemd-analyze plot" returns on stdout an SVG image of the systemd services/units startup timeline

Abdull
  • 2,432
0

Swayimg is capable of reading from stdin by providing - as an argument. For example, I use the following command as a makeshift magnifier, which just displays the current contents of the screen, but it's zoomable: grim - | swayimg -.

Isti115
  • 1,242