No Decode Delegate when using stdin

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
jocolloman
Posts: 3
Joined: 2012-04-19T12:08:34-07:00
Authentication code: 13

No Decode Delegate when using stdin

Post by jocolloman »

I am having a problem when passing an image to ImageMagick via stdin.

The following command is the one in question.

$ display < frog.pgm
display: no decode delegate for this image format `/var/tmp/magick-2094Xb6fonFohOuc' @ error/constitute.c/ReadImage/550.

However,

display frog.pgm

works just fine.

Interestingly, this works fine on Ubuntu but is not working on the Mac distribution.

Any thoughts?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: No Decode Delegate when using stdin

Post by fmw42 »

try piping the output from your other tool something equivalent to

convert rose: PGM:- | display -
jocolloman
Posts: 3
Joined: 2012-04-19T12:08:34-07:00
Authentication code: 13

Re: No Decode Delegate when using stdin

Post by jocolloman »

Unfortunately, the same error message comes up.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: No Decode Delegate when using stdin

Post by fmw42 »

Do you have X11 installed. IM display needs X11 (unix and mac)
Petr
Posts: 51
Joined: 2010-01-07T09:37:51-07:00
Authentication code: 8675309

Re: No Decode Delegate when using stdin

Post by Petr »

We experience the same problem.

Code: Select all

cat any.jpg | display
doesn't work.

Code: Select all

cat any.jpg | display jpg:-
works. Same e. g. for png. So it seems that the type of image is not correctly recognized.

See
https://bugzilla.novell.com/show_bug.cgi?id=882456
fmw42 wrote:Do you have X11 installed. IM display needs X11 (unix and mac)
Reporter said that display works for him, no?
Petr
Posts: 51
Joined: 2010-01-07T09:37:51-07:00
Authentication code: 8675309

Re: No Decode Delegate when using stdin

Post by Petr »

Hmm,

Code: Select all

cat any.png | display -
works.
Petr
Posts: 51
Joined: 2010-01-07T09:37:51-07:00
Authentication code: 8675309

Re: No Decode Delegate when using stdin

Post by Petr »

It seems that block 0000 - 0fff of the stdin is not copyied into temporary file in the wrong case.
Petr
Posts: 51
Joined: 2010-01-07T09:37:51-07:00
Authentication code: 8675309

Re: No Decode Delegate when using stdin

Post by Petr »

In the correct case:

Code: Select all

read(0, "\211PNG\r\n\32\n\0\0\0\rIHDR\0\0\0\30\0\0\0\30\10\6\0\0\0\340w="..., 262142) = 4380
read(0, "", 257762)                     = 0
read(0, "", 262142)    
In the wrong case:

Code: Select all

read(0, "\211PNG\r\n\32\n\0\0\0\rIHDR\0\0\0\30\0\0\0\30\10\6\0\0\0\340w="..., 4096) = 4096
read(0, "=I\22\202c\307\216\21\4\1\3\3\3W\327\33\r=;[y\241\263\263\263\305\267\2161I\262\261"..., 262142) = 284
read(0, "", 261858)                     = 0
read(0, "", 262142)      
The first 'wrong' read is thanks to DisplayImageCommand() behaviour, which is checking with getc() if there is some input on stdin or not. So at the end, it looks like:

Code: Select all

  char c, buffer[N];
  c = getc(stdin);    /* DisplayImageCommand() */
  ungetc(c, stdin);   /* DisplayImageCommand() */
  read(0, buffer, N); /* ReadBlob() */
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: No Decode Delegate when using stdin

Post by magick »

We can reproduce the problem you posted and have a patch in ImageMagick 6.8.9-4 Beta available within a few days. Thanks.
Petr
Posts: 51
Joined: 2010-01-07T09:37:51-07:00
Authentication code: 8675309

Re: No Decode Delegate when using stdin

Post by Petr »

Excelent, thanks! May I have the patch, please?
Post Reply