possible bug -gravity IM 6.7.8.2 Q16 Mac OSX Snow Leopard

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

possible bug -gravity IM 6.7.8.2 Q16 Mac OSX Snow Leopard

Post 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?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

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

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

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

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