MultiplyCompositeOp behaviour

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: MultiplyCompositeOp behaviour

Post by anthony »

Delete the alpha from both images, before multiplying them.
You can just turn it off with the 'matte' controls.

That hopefully will solve the problem.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: MultiplyCompositeOp behaviour

Post by anthony »

While reviewing...

As a first draft.

test image...

Code: Select all

   convert -size  100x100 gradient: \( +clone -rotate 90% \) \
                  -compose CopyOpacity -composite   test.png
this reads the image, 'saves' a backup for later reuse.
then separates the alpha channel, and multiplys ALL the channels.
The save image is then used to restore the original alpha.

Code: Select all

   convert test.png -write MPR:save \
          \( +clone -alpha extract \) -compose multiply -composite \
          MPR:save -compose DstIn -composite \
          pre-multiplied.png
NOTE: most of the Duff-Porter Compose Methods are defined in terms of pre-multiplied pixels, and Im does this internally. You would only need to do pre-multiplication if you were creating a new composition or something like it.

What Are you planning to use it for? It may already be in IM, or can be added to IM relativally easilly.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply