-
ImageMagick version6.9.11 Operating system, version and so onubuntu 23.04 Description
i want to remove background ( composite a.png b.png -compose ChangeMask res.png gives me this instead because the red spray has transparency: would there be any way to achieve this? |
Beta Was this translation helpful? Give feedback.
Replies: 0 comments 3 replies
-
I name your images
Some experimentation shows that you are wrong. Adding
However, using
So we need the inverse of Window syntax:
We use that alpha with red pixels for
This is very close. |
Beta Was this translation helpful? Give feedback.
-
See the pages I linked to. For each pixel, if we know the colour then we can calculate the opacity. Or, if we know the opacity, we can calculate the colour. If we know neither the colour nor the opacity, an almost infinite number of solutions are possible. |
Beta Was this translation helpful? Give feedback.
I name your images
transA.png
,transB.png
andtransExp.png
.transA.png
has no ICC colour profile, but the other two do have a profile. Why is that?transExp.png
is entirely red, with varying transparency.Some experimentation shows that you are wrong. Adding
transA.png
andtransExp.png
does not give transB.png.x.png
is not the same as `transB.png. Therefore subtracting transA from transB will not give the expected result.However, using
over
does work: