change in "compose -multiply" from IM 6.2 to 6.3?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: change in "compose -multiply" from IM 6.2 to 6.3?

Post by anthony »

Why are you even using multiply?

Multiply is a special purpose composition operator, it isn't meant to be used in the way you are using it.

What you are probably wanting is the default 'Over' Alpha Composition method. See IM Examples, Alpha Composition
http://imagemagick.org/Usage/compose/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
adamschneider

Re: change in "compose -multiply" from IM 6.2 to 6.3?

Post by adamschneider »

I used "multiply" because that's what Photoshop and other GUI graphic applications call it!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: change in "compose -multiply" from IM 6.2 to 6.3?

Post by anthony »

Applogies. I was a little rushed at the time I was last looking.

Using a 6.3.8 image magick (I am a sub-version behind the latest at this point) I did the following...

Code: Select all

convert triangle_white.png \
     \( +clone +matte -matte -fill red -colorize 100% \) \
     -compose multiply -composite -scale 1000% miff:- | display
The second line generates a pure red canvas image (with alpha channel)
to compose the original image against.
The result was a red image with a balck triangle. No transparency at all.

This is what I would have expected from the Mathematical compose operators which never really properly defined what they should do about the matte/alpha channel of the image.

However taking our the "+matte -matte" parts of the above command results in something similar to what you were after.

A red inside and transparent outside. However it isn't quite right either. For some reason the semi-transparent pixels were also tinted read too!!!

That did not make any sense at all unless those semi-transparent pixels were not semi-transparent black as I would expect. So I decided to check the original image, but overlaying it on pure black.

Code: Select all

convert triangle_white.png -background black -flatten \
      -scale 1000% miff:- | display
YEAP. your semi-transparent pixels are a semi-transparent gray!!!!
In other words your original image is probably not exactly what you think it is.

I'll see about getting the very latest version of IM, and trying the above again to see if I can repeat the original problem, you reported.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply