imdisplay command line parameters

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
efa
Posts: 8
Joined: 2012-04-27T06:18:57-07:00
Authentication code: 13

imdisplay command line parameters

Post 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.
Last edited by efa on 2012-05-05T15:49:18-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: imdisplay command line parameters

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
efa
Posts: 8
Joined: 2012-04-27T06:18:57-07:00
Authentication code: 13

Re: imdisplay command line parameters

Post 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?
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: imdisplay command line parameters

Post 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.
Wolfgang Hugemann
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: imdisplay command line parameters

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
efa
Posts: 8
Joined: 2012-04-27T06:18:57-07:00
Authentication code: 13

Re: imdisplay command line parameters

Post 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.
:-)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: imdisplay command line parameters

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
efa
Posts: 8
Joined: 2012-04-27T06:18:57-07:00
Authentication code: 13

Re: imdisplay command line parameters

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: imdisplay command line parameters

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
efa
Posts: 8
Joined: 2012-04-27T06:18:57-07:00
Authentication code: 13

Re: imdisplay command line parameters

Post 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.
Post Reply