[magick-users] image panning from the commandline using `display'

Anthony Thyssen anthony at griffith.edu.au
Thu Oct 11 18:06:01 PDT 2007


"Dean S. Messing" on  wrote...
| Suppose I have a 1000x1000 image named im.png.
| 
| If I execute `display -geometry 200x200 im.png' I get
| a 200x200 "viewport" of the image aligned at the top left corner.
| 
| How do I move the viewport on the command line?
| 
| Add offests, say `display -geometry 200x200+150+300 im.png', just
| moves the X-window on the desktop but the contents are the same.  Basically
| I'd like to "pan" the image from the commandline. 
| 
That would be useful.

My first guess would have been to use -page.

   display -page 200x200+50+50 im.png

However while that opens a 200x200 window, it positions the window
not the image.

Actually that probably should have been...
   display -page 200x200-50-50 im.png

As "page" sets an images virtual canvas, then places the image on that
canvas at the offset requested on that virtual canvas  As such the above
would move the top-left pixel o fthe actual to -50-50 on the virtual
canvas.

That is I would have expected the last to inital look like
   convert -page 200x200-50-50 im.png -flatten miff:- | display -

But with the ability to scroll around.
ASIDE: -flatten clips/fills out the images virtual canvas.


I would suggest you make a request on the developers forum to make

   display -page 200x200-50-50 im.png
or (without flatten)
   convert -page 200x200-50-50 im.png miff:- | display -

display a scrolling 'virtual canvas' viewport of the image.

Though what it should do if the image does not fill the virtual canvas
or its position is not on the virtual canvas is still not clear.  Move
'layer' images are smaller, and contained somewhere within its virtual
canvas.

Actually having "display", correctly displaying 'layer' images is
something that is probably long overdue.

ASIDE: "animate" does this already, but with clipping and no scrolling
as it is designed to animate a collection of 'layer' or GIF animation
images, nor display the individual layer images.  Internally "animate"
does a -coalesce into actual displayable frames, "display" should
display the actual layer images as is.


For more information see IM examples, Basics, Virtual Canvas
   http://imagemagick.org/Usage/basics/#page

Though that section still needs a lot of work.
May be better looking at  IM examples, Layers (Flatten, Mosaics, Merge)
   http://imagemagick.org/Usage/layers/#flatten

ASIDE: Merge is being added in the next point release.

Also see  Animation basics, Coalease & Frame Montage.
   http://imagemagick.org/Usage/anim_basics/#coalesce

Especially the introduction to the "gif_anim_montage" script I wrote.


  Anthony Thyssen ( System Programmer )    <A.Thyssen at griffith.edu.au>
 -----------------------------------------------------------------------------
  ``Isn't technology wonderful. Yes it is isn't it. It will be even
    better when we get some electrictry!  Yes, Yes it will, wouldn't it?''
                                               --- The Looney Toon Chupmunks
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/


More information about the Magick-users mailing list