Attempt to extract single-colored semi-transparent overlay from multi-colored background
Posted: 2016-12-28T10:02:38-07:00
So, I have 2 nearly identical images, except one has a semi-transparent overlay with a known color. Let's say Image A has the overlay, Image B is Image A without the overlay, and Image C is the overlay itself, which is the result I am trying to achieve.
Image A:
Image B:
Image C:
What I would personally do if Image B were a single color background is this:
The only thing is that image A is a multi color background, so what I need to do is operate this command on image A for every color in image B, substituting "$col" with the corresponding color in image B. I know I could also use -compose difference, but with the image I'm trying to operate on, due to the differences in colors being different, it didn't seem to work right, since the overlay was pink and was placed on top of red and white.
Image A:
Image B:
Image C:
What I would personally do if Image B were a single color background is this:
Code: Select all
convert 'IMGA.png' -level-colors "$col,#00FF00" \
-alpha copy +level-colors '#00FF00,#00FF00' \
'IMGC.png'