Page 1 of 1
-compose Multiply not wroking with RGBA files
Posted: 2019-04-11T13:10:04-07:00
by raabik
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):
Result :
magick composite "pattern_0.png" -compose Multiply "channels_0.png" "channelpattern.png"
Grayscale Images(Working)
Result
I am frustraded how to get multiply to work independtly for each Channel.
Re: -compose Multiply not wroking with RGBA files
Posted: 2019-04-11T13:52:53-07:00
by fmw42
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.
Re: -compose Multiply not wroking with RGBA files
Posted: 2019-05-14T08:58:55-07:00
by raabik
thanks for the answer, I somehow fixed that issue by using instead of the RGBA mask only an Grayscale mask, it than multiplies per channel as imo it should always.
Re: -compose Multiply not wroking with RGBA files
Posted: 2019-05-15T21:38:10-07:00
by GeeMack
raabik wrote: ↑2019-04-11T13:10:04-07:00I 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.
I'm not sure exactly what result you're trying to achieve, but there are several ways to composite the alpha channel from one image onto another. Fred described a common method using "
-alpha extract" and "
-alpha off -compose copy_opacity" above. Here is a command that uses a different compose method to get pretty much the same result...
Code: Select all
magick green.png pattern.png -compose copyalpha -composite result.png
That essentially extracts the alpha channel from "pattern.png" and applies it to "green.png". The result seems clearer than your first example, and doesn't leave those tiny gray lines around the edges of the alpha.