Page 1 of 1

possible bug -gravity IM 6.7.8.2 Q16 Mac OSX Snow Leopard

Posted: 2012-07-09T14:20:39-07:00
by fmw42
Gravity settings do not seem to work in -composite when there is a mask image.


This works fine.

convert $infile rose: -gravity center -compose over -composite show:


But this fails to show any overlay at all.

convert $infile rose: \( -clone 1 -threshold 0 \) -gravity center -compose over -composite show:


Am I misunderstanding something here or is this a bug?

Re: possible bug -gravity IM 6.7.8.2 Q16 Mac OSX Snow Leopar

Posted: 2012-07-09T15:04:37-07:00
by magick
Gravity does not apply to the image mask, only the source image. If you think it should, run it past Anthony for his insight. Should be implement the enhancement at all? If so, IMv7 only or IMv7 and IMv6?

Re: possible bug -gravity IM 6.7.8.2 Q16 Mac OSX Snow Leopar

Posted: 2012-07-09T15:29:08-07:00
by fmw42
magick wrote:Gravity does not apply to the image mask, only the source image. If you think it should, run it past Anthony for his insight. Should be implement the enhancement at all? If so, IMv7 only or IMv7 and IMv6?

OK. Thanks for the correction. I see that now at http://www.imagemagick.org/Usage/compose/#mask

I will contact Anthony for his comments.

Re: possible bug -gravity IM 6.7.8.2 Q16 Mac OSX Snow Leopar

Posted: 2012-07-09T20:16:07-07:00
by anthony
I do not think it should change at all.

The mask is used as a write mask (actually a protect mask) for the destination image. Always has been.

This is the verbose form of a three image composite.

Code: Select all

    destination_image  -mask negated_mask_image \
    source_image -composite +mask
It is added as in addition to the normal transparency (a sort of read mask though it isn't really) of the source image.

For example see the Very old Bug report of how it actually works...
http://www.imagemagick.org/Usage/bugs/composite_mask/


NOTE masked composition is technically not a composition method at all, and could be separated. Doing so will have the advantage of making -composite purely two image compostion.

If compose is only a two image compostion, then we have other advantages.

For example IM could allow easier compostions without needing so many parenthesis, a processing style known as reverse polish notation (or RPN - google wikipedia for it). That is -composite always composes and replaces just the last two images in the image list (preserving any other images in the list), rather than compose the first two and junk the rest.

For example a 'source masked compostion could become simply...

Code: Select all

Dest_image Source_Image Source_Mask_image \
          -compose CopyAlpha  -composite \
          -compose Over -composite
When means add the mask to the source image, then overlay the result on the destination.
Study it with regard to RPN.

The above is just an idea, and not reality. At least not yet.

Re: possible bug -gravity IM 6.7.8.2 Q16 Mac OSX Snow Leopar

Posted: 2012-07-09T21:20:25-07:00
by fmw42
anthony wrote: For example IM could allow easier compostions without needing so many parenthesis, a processing style known as reverse polish notation (or RPN - google wikipedia for it). That is -composite always composes and replaces just the last two images in the image list (preserving any other images in the list), rather than compose the first two and junk the rest.

For example a 'source masked compostion could become simply...

Code: Select all

Dest_image Source_Image Source_Mask_image \
          -compose CopyAlpha -composite \
          -compose Over -composite 
When means add the mask to the source image, then overlay the result on the destination.
Study it with regard to RPN.
OK. I follow the example and RPN approach. However, that may confuse many users.

The alternate is to keep it as it is today with forward sequence processing (non RPN approach) and just use parens, such as

Code: Select all

convert dest \( source mask -alpha off -compose copy_opacity -composite \) \
           -gravity XX -compose over -composite result