Search code examples
shellcommand

piping qrencode to eog to avoid creating a file


The following line in the terminal will save a .png image file for a weblink:

qrencode -o qrcode.png 'https://en.wikipedia.org/wiki/Main_Page'

You can then view the qrcode with

eog qrcode.png

How can you pipe the first command into the second and avoid creating a file?

Have tried for example:

qrencode 'https://en.wikipedia.org/wiki/Main_Page' | eog

..but it didn't work.


Solution

  • The problem is that you need an image viewer that is happy to read an image from a pipe. Here are two that will work.

    Firstly, with feh:

    qrencode -o - 'www.thesetchells.com' | feh -
    

    Secondly, with ImageMagick:

    qrencode -o - 'www.thesetchells.com' | magick display -
    

    If you use older v6 ImageMagick, omit the word magick in the example above.