Page 1 of 1

No Decode Delegate when using stdin

Posted: 2013-06-03T10:05:23-07:00
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?

Re: No Decode Delegate when using stdin

Posted: 2013-06-03T12:01:54-07:00
by fmw42
try piping the output from your other tool something equivalent to

convert rose: PGM:- | display -

Re: No Decode Delegate when using stdin

Posted: 2013-06-04T10:49:47-07:00
by jocolloman
Unfortunately, the same error message comes up.

Re: No Decode Delegate when using stdin

Posted: 2013-06-04T15:46:31-07:00
by fmw42
Do you have X11 installed. IM display needs X11 (unix and mac)

Re: No Decode Delegate when using stdin

Posted: 2014-06-15T23:32:53-07:00
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?

Re: No Decode Delegate when using stdin

Posted: 2014-06-15T23:37:47-07:00
by Petr
Hmm,

Code: Select all

cat any.png | display -
works.

Re: No Decode Delegate when using stdin

Posted: 2014-06-16T02:22:35-07:00
by Petr
It seems that block 0000 - 0fff of the stdin is not copyied into temporary file in the wrong case.

Re: No Decode Delegate when using stdin

Posted: 2014-06-17T03:34:35-07:00
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() */

Re: No Decode Delegate when using stdin

Posted: 2014-06-17T04:54:47-07:00
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.

Re: No Decode Delegate when using stdin

Posted: 2014-06-17T05:19:37-07:00
by Petr
Excelent, thanks! May I have the patch, please?