Results 1 to 5 of 5

Thread: Bash piping

  1. #1
    Join Date
    Aug 2008
    Location
    Mexico and Sweden
    Posts
    1,288

    Default Bash piping

    I am trying to pipe a jpg filename to the Image Magick display command. As in "cat myfile | display". "myfile" contains a jpg filename. It returns the error "display: no decode delegate for this image format `/tmp/magick-XXPOGHGV' @ error/constitute.c/ReadImage/532". What am I doing wrong? If I invoke display with the jpg filename, it works just fine.

    Thanks.

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,974

    Default Re: Bash piping

    Reading
    Code:
    man display
    I see that it should be invoked as
    display [options] input-file
    Thus the input file is a field in the command line. What you do is sending text to stdin of the display program, but nowhere is said that it does read anything from stdin.
    I guess it will work when you do
    Code:
     display $(cat myfile)
    or even shorter
    Code:
    display $(<myfile)
    Henk van Velden

  3. #3
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Bash piping

    On 2011-10-03 22:26, ionmich wrote:
    >
    > I am trying to pipe a jpg filename to the Image Magick display command.
    > As in "cat myfile | display". "myfile" contains a jpg filename. It
    > returns the error "display: no decode delegate for this image format
    > `/tmp/magick-XXPOGHGV' @ error/constitute.c/ReadImage/532". What am I
    > doing wrong? If I invoke display with the jpg filename, it works just
    > fine.


    Not all programs accept input that way.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)

  4. #4
    Join Date
    Jul 2008
    Location
    Seattle, WA
    Posts
    17,048

    Default Re: Bash piping

    On Mon, 03 Oct 2011 20:26:03 +0000, ionmich wrote:

    > If I invoke display with the jpg filename, it works just fine.


    Piping the name in from a file is not the same as invoking with the
    filename.

    What you're doing is telling it the contents of the file are the image
    data.

    Jim

    --
    Jim Henderson
    openSUSE Forums Administrator
    Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

  5. #5
    Join Date
    Aug 2008
    Location
    Mexico and Sweden
    Posts
    1,288

    Default Re: Bash piping

    Quote Originally Posted by hcvv View Post
    Reading
    Code:
    man display
    I see that it should be invoked as

    Thus the input file is a field in the command line. What you do is sending text to stdin of the display program, but nowhere is said that it does read anything from stdin.
    I guess it will work when you do
    Code:
     display $(cat myfile)
    or even shorter
    Code:
    display $(<myfile)
    Thank you very much. My incorrect assumption was that "display" accepts stdin. I will be more careful in future.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •