Page 1 of 1

imdisplay command line parameters

Posted: 2012-04-27T06:29:21-07:00
by efa
hi,
I'm writing a crossplatform bash script, on Windows I use cygwin.
As the target PC has no Xserver, when on Linux I use 'display', on Win32 I use 'imdisplay'.
The problem arise using command line parameters, as 'display' support lines so:
$ display -resize 350x90 image.png
while I'm not able to use the similar:
$ imdisplay size=350x90 image.png

I found some 'imdisplay' command line reference here:
http://dev.man-online.org/man1/imdisplay/
http://space.mit.edu/cxc/slgtk/doc/html/slgtk-10.html
http://space.mit.edu/cxc/slgtk/doc/html/slgtk-6.html
and changelog up to 0.7.6 (I have 1.0 on Win32):
http://space.mit.edu/~mnoble/slgtk/CHANGELOG
no one helped.

Re: imdisplay command line parameters

Posted: 2012-05-01T00:23:00-07:00
by anthony
you may need to use convert to do your image operations then use "imdisplay" to display it.

I am not certain of the syntax of the windows "imdisplay" command - sorry.

Re: imdisplay command line parameters

Posted: 2012-05-02T04:49:15-07:00
by efa
anthony wrote:you may need to use convert to do your image operations then use "imdisplay" to display it.
I am not certain of the syntax of the windows "imdisplay" command - sorry.
converting to a temp file with convert on Win32 platform work as expected, but add overhead.

About imdisplay, I tested different syntax but I always got error:
$ imdisplay size=350x90 image.png
$ imdisplay size="350x90" image.png
$ imdisplay "size=350x90" image.png
$ imdisplay "size=350x90,image.png"
$ imdisplay size=350x90,image.png
$ imdisplay size=350x90;image.png
$ imdisplay size=350x90:image.png
$ imdisplay image.png size="350x90"
$ imdisplay image.png "size=350x90"
$ imdisplay image.png:size=350x90
noone worked.
Interestingly, installing the slshell package and slgtk (now unsupported) package, following:
http://space.mit.edu/cxc/slgtk/doc/html/slgtk-6.html
giving command from slsh interpreter (call the function directly), I got no error and correct results.

Any idea on how invoke imdisplay 1.0 from command line, after all it is distributed with last Imagemagick, should be someone know how it work?

Re: imdisplay command line parameters

Posted: 2012-05-05T10:06:16-07:00
by whugemann
I have always wandered what IMdisplay is good for other than visualising MIFF files. Under Windows, it suffices to write image.png in the CMD box (or in the Run box) and Windows will automatically open the file by help of the standard program associated with its file extension. If you want to rescale the image before dispplaying it, just do so by the help of Convert.

If you don't want to rely on this standard behaviour, you could explicitly call the viewer program, handing it the filename as the first parameter and any other parameters it might possibly need. IMHO, IrfanView is a much more versatile viewer than IMdisplay under Windows. Therefore I would rather call
%PROGRAMFILES%\IrfanView\I_view32 image.png

There are a lot of command line options influencing IrfanView's behaviour. You could for example set the long side of the image by
%PROGRAMFILES%\IrfanView\i_view32 image.png /resize_long=350 /resample /aspectratio

AFAIK, IMdisplay's command line options (if there are any) are undocumented.

Re: imdisplay command line parameters

Posted: 2012-05-08T23:31:18-07:00
by anthony
NOTE that IM does have a good delegates system, which you can use to create your own image display method.

I myself added a delegate called 'remote:' that will update an already running "display" program (or run one with an warning)!

Code: Select all

<!-- A very useful alternative to 'show:' -->
  <delegate decode="miff" encode="remote" command=""display" -remote "ephemeral:%i" &  while [ -f "%i" ]; do usleep 100; done "/>
l also have a zero-delay "show:" type command called "display:" that does not wit 2 seconds. Something I want to fix in the IM delegate "spawn" handler, which is working in a rather silly way.

Code: Select all

<!-- Using a shell to handle the 'spawn' aspect - very fast! -->
  <delegate decode="miff" encode="display" command=""display" -delay 0 -window-group %[group] -title "%l " "ephemeral:%i" & while [ -f "%i" ]; do usleep 100; done"/>
perhaps you like to create a irfanview version

Re: imdisplay command line parameters

Posted: 2012-05-10T01:41:36-07:00
by efa
sure the 'imdisplay' binary isn't packaged with Cygwin IM package. Work on my system because I have both Cygwin and native Win32 ImageMagick.
So this is not a good choice as alternative to 'display' on Win32 system without the Xserver.
As simple viewer the Windows built in is good, but as you need some simple operations like a display resize, become a nightmare.
And packaging IrfanView with my script is like use a nuclear rocket agaist a bacteria.
:-)

Re: imdisplay command line parameters

Posted: 2012-05-10T16:51:37-07:00
by anthony
Can imdisplay take a image via a stdin?

If so you can do something like

Code: Select all

   convert image.png  -thumbnail 640x480 png:- | imdisplay -
Also try this with both cgiwin and windows IM...

Code: Select all

   convert image.png  -thumbnail 640x480 win:
See
http://www.imagemagick.org/Usage/files/#show

Re: imdisplay command line parameters

Posted: 2012-05-14T04:45:47-07:00
by efa
anthony wrote:Can imdisplay take a image via a stdin?
If so you can do something like

Code: Select all

 convert image.png  -thumbnail 640x480 png:- | imdisplay -
tested, seems 'imdisplay' ignore the stdin.
I tried:

Code: Select all

$ convert gpib488err1.PNG -thumbnail 640x480 png:- | imdisplay -
no errors, but open 'imdisplay' with nothing displayed
anthony wrote: Also try this with both cgiwin and windows IM...

Code: Select all

 convert image.png  -thumbnail 640x480 win:
See
http://www.imagemagick.org/Usage/files/#show
tested:

Code: Select all

$ convert gpib488err1.PNG -thumbnail 640x480 show:
display: unable to open X server `localhost:0' @ error/display.c/DisplayImageCommand/428.

$ convert gpib488err1.PNG -thumbnail 640x480 win:
display: unable to open X server `localhost:0' @ error/display.c/DisplayImageCommand/428.

$ convert gpib488err1.PNG -thumbnail 640x480 x:
convert: unable to open X server `localhost:0' @ error/display.c/DisplayImages/1664.
keeping the Xserver OFF, neither work on Cygwin.
While obviusly work on Cygwin with Xserver ON, and on Linux with X ON.
At the end 'convert' invoke 'display' that depends on the Xserver.
It is 'imdisplay' that is small and compiled natively for Windows GDI lib, and has no X dependancies.

Re: imdisplay command line parameters

Posted: 2012-05-14T17:58:30-07:00
by anthony
Seems to me that the 'show:' or 'win:' delegate could use some improvement for the Windows/Cygwin environments.

either by including a simple display program (or fixing "imdisplay"), or locating and using other 'display' options.

Perhaps even looking at system defaults for the appropriate 'display' program the user has defined.

Re: imdisplay command line parameters

Posted: 2012-05-18T00:28:23-07:00
by efa
good ideas. When on cygwin can or can not be present an Xserver. When not present 'display' should redirect the output to native GDI lib.
A strategy can be sense the $DISPLAY, if not defined, go for GDI.
And go for GDI always when win: output is specified, is this intended for this ?

On the other side the Win32 native IM port, the Xserver is ever miss, and DISPLAY not defined. There 'display' should go always for GDI lib.
Some help come from GDI backend 'canvas' rendering of Cairo lib native ported to win32 (I'm speaking about mingw binary).

About 'imdisplay enhancements, I tried to understand where it process the arguments, see:
viewtopic.php?f=2&t=20939&p=84585#p84585
but this is not clear to me. Maybe some Win developer can answer if the symbols 'CCommandLineInfo', 'ParseCommandLine' and 'ProcessShellCommand' are defined in Windows headers for example.