To reproduce this:
require 'image'
img = image.load('input_pipe')
image.display(img)
On another terminal, run:
mkfifo input_pipe
cat <image_file> > input_pipe
Notice that calling cat <image_file> > input_pipe
once doesn't load the image. You have to call it twice. My guess is that image.load
opens the file twice. Any help/alternative would be appreciated.
Answered here. Apparently, image.load()
opens the image file to find out the file type and then opens it again to call the respective image loader e.g. image.loadJPG()