Search code examples
bashunixpipeimagej

Piping filename for last create file into imagej does not show image


I have a large directory of images and want to access the most recent one via command line. I want to show it using imagej, but the piping of the command does open imagej, but does not open an image:

  ls -Art | tail -n 1| imagej 

is the command I am using. Am I doing sth wrong? I am on a docker image using xubuntu.

If I only use the ls -Art | tail -n 1 i get the image: 1541917543_right.tiff. Which is shown correctly if I use the imagej command with the filename.


Solution

  • It might be a case of needing to use the --open option:

    ls -Art | tail -n 1 | imagej --open
    

    Or perhaps try using xargs:

    ls -Art | tail -n 1 | xargs imagej --open 
    

    There was also a bug report filed regarding the opening images from cli (legacy version) on github. If the above suggestions don't work maybe post a response over there.