Broken pipe error

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Salsalex2011
Posts: 4
Joined: 2015-04-08T10:35:14-07:00
Authentication code: 6789

Broken pipe error

Post by Salsalex2011 »

Hello hello,

New user to IM, I try to compare 2 images and showing the resulting in IMDisplay directly (without creating a file)
After searches I still cannot understand the reason of below error:

D:\DATA>compare.exe "image1.bmp" "image2.bmp" miff:- | imdisplay.exe

This just show IMdisplay with not content then, after I closes it, shows the error message:

compare.exe: unable to write blob `-': Broken pipe @ error/blob.c/ImageToFile/1730.


I'm running IM 6.9.0 Q16 64 bits on a dos command box on win 7 pro 64bits.

Are there some setup to allow pipe ? or any other trick ?

Thanks for any help :)

ALeX
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Broken pipe error

Post by snibgo »

I confirm your command doesn't work, on IM v6.9.1-0. Both of the following alternatives do, using imdisplay:

Code: Select all

compare rose: rose: show:

compare rose: rose: miff:- |convert - show:
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Broken pipe error

Post by fmw42 »

I do not know much about windows nor imdisplay.exe, but do you not need a - for standard in when using a pipe to some display command to tell it to retrieve the standard out from the miff:-. So something like

Code: Select all

compare.exe "image1.bmp" "image2.bmp" miff:- | imdisplay.exe -
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Broken pipe error

Post by snibgo »

I should have mentioned: I tried ...

Code: Select all

compare rose: rose: miff:- |imdisplay -
... but it doesn't work. imdisplay runs, but with no image, and we get the message:

Code: Select all

compare.exe: unable to write blob `-': Broken pipe @ error/blob.c/ImageToFile/1730.
These two also don't work:

Code: Select all

f:\web\im>%IM%convert rose: miff:- |%IM%imdisplay -
convert.exe: unable to write blob `-': Broken pipe @ error/blob.c/ImageToFile/1730.

f:\web\im>%IM%convert rose: miff:- |%IM%imdisplay
convert.exe: unable to write blob `-': Broken pipe @ error/blob.c/ImageToFile/1730.
The workaround, as in my first post, is to use "show:", or use convert on the right side of the pipe.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Broken pipe error

Post by fmw42 »

Try png:- or or tiff:- and see if they work. It could be a miff: issue
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Broken pipe error

Post by fmw42 »

Just curious, but I thought show: was a unix only tool. But perhaps I am wrong. Perhaps you can configure the delegates.xml file to use imdisplay or some windows tool to display the image when show: is used. If so, it might be useful to others to know how you did the configuration. I presume you are using show: outside Cygwin. But does it work in Cygwin along with x: if X11 delegate is installed. It might be nice to add something to the docs at http://www.imagemagick.org/Usage/windows/
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Broken pipe error

Post by snibgo »

Tiff:- and png:- don't work here. I suspect imdisplay isn't reading from stdin.

I don't use or know X.

show: and win: both work in pre-built binaries of recent IM versions, under Windows, with no changes required.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Broken pipe error

Post by fmw42 »

snibgo wrote: show: and win: both work in recent IM versions, under Windows, with no changes required.
Nice to know. Perhap Dirk fixed them. I never thought that show: would work with Windows.

Thanks
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Broken pipe error

Post by dlemstra »

Magick enabled this two years ago, he should get the credits. IMDisplay can only read from a file and has no support for reading from stdin at the moment. I will bookmark this topic and see if I can add support for this at some point
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Salsalex2011
Posts: 4
Joined: 2015-04-08T10:35:14-07:00
Authentication code: 6789

Re: Broken pipe error

Post by Salsalex2011 »

Thanks all for all these feedbacks :)

I have no problem with show: indeed, that's my current workaround. But I need to use IMDisplay (or maybe something else) in order to control better the displayed picture (eg show full screen or window sized properly to fit the full content (no need to scroll))...

Cannot try yet your tips, I'll do later today and let you know my findings, if any.

Thanks again :)
Salsalex2011
Posts: 4
Joined: 2015-04-08T10:35:14-07:00
Authentication code: 6789

Re: Broken pipe error

Post by Salsalex2011 »

Dear All,

Well, it's ok with convert instead of IMdisplay. Seems to confirm the pipe is not possible with it.
But I still don't know yet how to open the window in IMdisplay so that it is maximized and the size of the IMdisplay window itself is large enough to contain the full picture without any need of scrollbars...
Any idea is welcome - I'd like to avoid playing with delegate for now... if possible.

Thx
ALeX
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Broken pipe error

Post by snibgo »

Salsalex2011 wrote:But I still don't know yet how to open the window in IMdisplay so that it is maximized and the size of the IMdisplay window itself is large enough to contain the full picture without any need of scrollbars...
I don't think that is possible with IMdisplay.

I have set up IM so converting to "msph:" uses Microsoft Photo Viewer, which by default reduces an image to fit in the window.

Code: Select all

convert wizard: msph:
The MS Photo Viewer command line is horrible. The input file must include the full path, with backslashes, not forward slashes. This is awkward (impossible?) to do directly in delegates.xml. So I do it via a BAT file.

msph.bat is in a directory in my %PATH%. It contains a single line:

Code: Select all

rundll32.exe "C:\Program Files\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %~dpnx1
c:\users\Alan\.magick\delegates.xml contains:

Code: Select all

  <delegate decode="png" encode="msph" command="msph.bat %i"/>
snibgo's IM pages: im.snibgo.com
Salsalex2011
Posts: 4
Joined: 2015-04-08T10:35:14-07:00
Authentication code: 6789

Re: Broken pipe error

Post by Salsalex2011 »

Thanks fro the idea, I'll try it :-)
marcomarsala
Posts: 1
Joined: 2016-05-10T23:39:48-07:00
Authentication code: 1151

Re: Broken pipe error

Post by marcomarsala »

Personally, I'm still experiencing "Broken pipe error" on Linux with IM 6.7 whil converting in tif format from the CLI
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Broken pipe error

Post by snibgo »

@marcomarsala: I don't know if your post is serious. Unless you tell us the version of IM you use, and what command you use, and what happens instead, no advice is possible.
snibgo's IM pages: im.snibgo.com
Post Reply