[fixed] Add a flag for display for no 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
broucaries
Posts: 467
Joined: 2008-12-21T11:51:10-07:00

[fixed] Add a flag for display for no stdin

Post by broucaries »

Hi,

On debian we are trying to use a desktop file in order to run display

The problem is windows manager use /dev/null as stdin

the desktop entry is
display %f
where %f is an optionnal file if selected on interface.

If we use this we do not get dispaly run from the menu. indeed menu run display.im6 and get /dev/null

We workarround the problem using the following script:
if [ $# -ge 1 ]; then
exec /usr/bin/display.im6 "$@"
else
exec /usr/bin/display.im6 magick:logo
fi

Could you thus add a flag -nostdin that read the file give on the command line and by default display logo ?

Bastien
Last edited by broucaries on 2012-07-23T09:54:30-07:00, edited 1 time in total.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Add a flag for display for no stdin

Post by anthony »

I can verify this strange behaviour.

Code: Select all

display image  
displays an image

Code: Select all

display    
(with a tty on stdin) displays 'logo:'

Code: Select all

display /dev/null
displays 'logo:'

Code: Select all

display </dev/null  
does nothing at all and just exits This is an error, should be as previous

Code: Select all

display - </dev/null  
produces an error 'no decode delegate'. Not input is EOF!

Code: Select all

display miff:- </dev/null
produces an valid error 'improper image header' (from the builtin MIFF coder)

Really display on reading a EOF (even for MIFF) should result in 'no images' and just display logo (unless some other swicth is specified).


Display could use options about whether the 'command widget' or 'image magnification' features should be returned, or perhaps as a new feature, to simply return 'user point picking'... "montage" has a '-mode' option that could be used for similar effect.

Note the big feature 'display' has is -remote option, something few image display programs have... See
http://www.ict.griffith.edu.au/anthony/ ... ontrol.txt
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Add a flag for display for no stdin

Post by magick »

We can reproduce the problem you posted and have a patch. Look for it in ImageMagick-6.7.7-6 Beta by sometime tomorrow. Thanks.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Add a flag for display for no stdin

Post by anthony »

Code: Select all

display </dev/null  
now displays the logo

The others remain unchanged.

Note if an error occurs in an image so that no valid image results for display, logo will be displayed.

This may not be right. Logo should be displayed if no image is given.
But if an image is given, but errors, then perhaps display should just report error (like it does) and exit without displaying anything.

For example for

Code: Select all

display - </dev/null
where a image is given '-' but errors with 'no decode delegate'
OR

Code: Select all

display miff:- </dev/null
with an error of 'improper image header'.


Also what about 'streaming' image file formats like MIFF and PBMplus?
Zero images in the stream may actually be valid, and not an error?

Would "broucaries" like to comment!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply