-compose Multiply not wroking with RGBA files

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?".
Post Reply
raabik
Posts: 1
Joined: 2019-04-11T12:28:31-07:00
Authentication code: 1152

-compose Multiply not wroking with RGBA files

Post by raabik » 2019-04-11T13:10:04-07:00

I was trying to use:

magick composite "pattern.png" -compose Multiply "green.png" "mrp3.png"

what is wrong for RGB channels, only alpha channel has correct A amount, than I tested if it would work for only grayscale and for only one channel( R ) and it worked, as expected.

RGBA Images Mulitply(Not Wowking):
Image
Image
Result :
Image



magick composite "pattern_0.png" -compose Multiply "channels_0.png" "channelpattern.png"


Grayscale Images(Working)
Image
Image
Result
Image

I am frustraded how to get multiply to work independtly for each Channel.

User avatar
fmw42
Posts: 24735
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -compose Multiply not wroking with RGBA files

Post by fmw42 » 2019-04-11T13:52:53-07:00

What version of ImageMagick? What platform/OS?

magick composite is not as flexible as just magick for doing compositing. You should start using that.

Your pattern image has transparency. So you should be using -compose copy_opacity -composite with magick using its alpha channel and putting that alpha channel into the alpha channel of the green image.

Unix syntax:

Code: Select all

magick green.png \( pattern.png -alpha extract \) -alpha off -compose copy_opacity -composite result.png
Window syntax:

Code: Select all

magick green.png ( pattern.png -alpha extract ) -alpha off -compose copy_opacity -composite result.png
If you really want multiply, then

Code: Select all

magick green.png \( pattern.png -alpha extract \) -compose multiply -composite result.png
or

Code: Select all

magick green.png \( pattern.png -alpha off \) -compose multiply -composite result.png
Since the alpha channel is the same as the pattern image base channels.

But then the result will have a black background.

Post Reply