On Mon, 23 Nov 2009 20:45:55 +1100 (EST)
"damien dunlop" <[email protected]> wrote:

| I have hundeds of multi-line imagemagick scripts. Any one
| script may involve all of cropping, pasting, appending, drawing,
| annotating etc, etc.
| 
| However recently, it was discovered by accident that
| command order matters even when intuitively, one may think
| it should not. This now demands the review of many old scripts
| for the potential introduction of artifacts not previously noticed.
| 
| One might think operating on one area of a canvas should not
| effect another area, but it can.
| 

This was the major change between IM v5 and IM v6.  image operations
are done in the order given.  Reading images is also an operation!
Not reading images first causes Im to fall back to the old v5 legacy
handling.

See IM Examples, Basics,  for the reasons why!
   http://www.imagemagick.org/Usage/basics/

IM v7 will probably see the enforced requirement to read the image
BEFORE applying operators to them, as this will allow for better
scripting, and piping of 'commands' to an IM command for 'demonic'
style of image handling.


  Anthony Thyssen ( System Programmer )    <[email protected]>
 --------------------------------------------------------------------------
     Dungeons and Dragons Famous Last Words: 
                      "C'mon DM, let's see some REAL monsters!"
 --------------------------------------------------------------------------
     Anthony's Castle     http://hobbit.ict.griffith.edu.au/~anthony/




| The following is an example with drawing a straight line.
| 
| An image is to be positioned on a canvas.
| A line is to be drawn on another area of the canvas.
| If the line is drawn after positioning the image on the
| canvas, the line is drawn on the canvas as expected, but
| it is also drawn in the same relative position on the image.
| If the line is drawn first and then the image is
| positioned, the line appears only where it was first drawn.
| 
| One has to wonder if such behaviour is a feature, an oversight or bug?
| 
| convert -size 100x80 xc:lightblue A.gif           # Make a test image
| 
| convert -size 200x200 xc:yellow \
|      \( A.gif -repage 0x0+100+0 \) \
|         -draw 'line 0,40 50,40' \
|      \( A.gif -repage 0x0+100+120 \) \
|         -draw 'line 0,160 50,160' \
|         -flatten \
|         win:
| 
| Damien
| 
Well of course you get what you got.  That is what you asked for!

-draw and all other image operators, (except -geometry resize)
is applied to ALL images in the current image sequence.

Your indentation is not showing this and should be...


convert -size 200x200 xc:yellow \
        \( A.gif -repage 0x0+100+0 \) \
        -draw 'line 0,40 50,40' \
        \( A.gif -repage 0x0+100+120 \) \
        -draw 'line 0,160 50,160' \
        -flatten \
        win:

the first draw is applyed to two images.
-draw ignores any virtual space, so both images get a line.

The second draw is applied to three images.
but only the yellow background image gets a line as it is the only one
large enough.  The other two image do not get additional lines.

The result 3 lines!  It is correct!!!!

If you want the draw to apply to just the last image. then put the draw
in the parenthesis with that image, and ignore its virtual offset.


_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to