Page 1 of 1
Subtracting 100% match only?
Posted: 2017-02-09T15:17:26-07:00
by Rye
So,
Let's assume I want to "subtract" this image:
from this:
Thereby removing the Logo in the back completly, without harming the image in the foreground.
Is this possible by using imagemagick (preferably without masking etc.)
Regards:
Rye
Re: Subtracting 100% match only?
Posted: 2017-02-09T15:30:28-07:00
by snibgo
With a difference composite, we can find which pixels are identical in the two images. Then we can use that as a mask to do whatever we want, such as turning those pixels transparent in the second image.
Re: Subtracting 100% match only?
Posted: 2017-02-09T15:59:05-07:00
by fmw42
What is your IM version and platform? Please always provide that when asking questions, since syntax may differ.
Re: Subtracting 100% match only?
Posted: 2017-02-10T00:54:42-07:00
by Rye
Version in sig.
For now this is what I came up with...
Code: Select all
@echo off
mkdir BG | move BG.png BG
for %%x in (*png) do convert %%x BG/BG.png -compose difference -composite -threshold 0 -separate -evaluate-sequence Add mask.png
convert mask.png -alpha remove mask.png
convert mask.png -transparent "#FFFFFF" mask.png
move mask.png BG
for %%x in (*.png) do convert -page +0+0 %%x -page +0+0 BG/mask.png -flatten %%x
cd BG
move BG.png ..
cd BG|del *.png
pause