title: ImageMagick API for command-line GUI application interface to `display`
body: <p>I'd like to, basically, have a quick way to select a box (region of interest) in an image, and get geometry output in ImageMagick's format. I cannot see an easy way to do it with the default ImageMagick <code>display</code> viewer, so I'm looking for some API (and hopefully examples) to allow me to code my own viewer. </p>
  
  <p>A bit of background: In <a href="http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&amp;t=12267&amp;start=0" rel="nofollow noreferrer">ImageMagick • View topic - selecting a region of interest from command line</a> (2008) it is said you cannot do it, however, there is <a href="http://imagemagick.sourceforge.net/http/www/display.html#regi" rel="nofollow noreferrer">display: ImageMagick - Region of Interest</a> (2003?) which explains how to do it (but apparently it refers to an older version). </p>
  
  <p>Anyways, this is how things look is you call <code>display -size 300x500 pattern:checkerboard</code> (<em><code>pattern:checkerboard</code> is built-in pattern image in imagemagick</em>):</p>
  
  <p><img src="https://i.stack.imgur.com/sS9zh.png" alt="imagemagick display ROI"></p>
  
  <p>Once the "ImageMagick" display window is up, click on it; then Command menu shows - from it, choose /"Image Edit"/"Region of Interest..."; then can click and drag on the viewer display window. And you also get the geometry in upper left corner - but you cannot copy/paste it as text (so I've had to retype).  </p>
  
  <p>Also, <code>display</code> in command line mode takes up the terminal (<a href="https://superuser.com/questions/426176/make-imagemagicks-display-exit-at-terminal-preserving-the-window-single-ins#comment489030_426176">linux - Make imagemagick's <code>display</code> exit at terminal, preserving the window (single instance mode) - Super User</a>) - and I cannot see a way to force it to run in "single instance mode", such that I could issue filenames on the command line, and <code>display</code> would load them in the one and the same currently running instance. </p>
  
  <p>Now, I've found <a href="http://www.ibm.com/developerworks/opensource/library/os-imagemagick/index.html#prog_manipulation" rel="nofollow noreferrer">Casting spells with ImageMagick - Image manipulation for programmers</a> (2012), which mentions a MagickWand API; after some searching, I found on the <code>imagemagick</code> site:</p>
  
  <ul>
  <li><a href="http://www.imagemagick.org/script/magick-wand.php" rel="nofollow noreferrer">ImageMagick: MagickWand, C API for ImageMagick</a></li>
  <li><a href="http://www.imagemagick.org/script/magick-core.php?ImageMagick=ilvg2dv5rhem7jttol79c6h8j2" rel="nofollow noreferrer">ImageMagick: MagickCore, Low-level C API for ImageMagick</a></li>
  <li><a href="http://www.imagemagick.org/script/perl-magick.php" rel="nofollow noreferrer">ImageMagick: PerlMagick, Perl API for ImageMagick</a></li>
  <li><a href="http://www.imagemagick.org/script/magick++.php" rel="nofollow noreferrer">ImageMagick: Magick++, C++ API for ImageMagick</a></li>
  </ul>
  
  <p>So, my first thought was a script in Python - but apparently there is only a Perl API, which is fine. </p>
  
  <p>However, what I need to code is basically a command line interface, which will start a <code>display</code> -like window process as a "single instance", and exit the terminal while passing parameters such as file name, <code>-density</code> etc to the window; the window would then react on mouse clicks, allowing selection of a crop geometry box (region of interest) - and finally, render the geometry string in a text box, so you can copy it. But as far as I can see, all the APIs are oriented toward performing the functions of the command-line <code>convert</code>. </p>
  
  <p>So my question is - can any of these API's be used to program a <code>display</code>-like GUI; and do there exist any examples of a similar nature (<em>preferably in a scripting language, but I'll live with C/C++</em>) which can be pointed out? </p>
  
  <p>Many thanks in advance for any answers,<br>
  Cheers!</p>