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
Subtracting 100% match only?
Subtracting 100% match only?
Version: ImageMagick-7.0.7-28-Q16-x64-static http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Subtracting 100% match only?
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.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Subtracting 100% match only?
What is your IM version and platform? Please always provide that when asking questions, since syntax may differ.
Re: Subtracting 100% match only?
Version in sig.
For now this is what I came up with...
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
Version: ImageMagick-7.0.7-28-Q16-x64-static http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC