Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Rye
Posts: 158 Joined: 2013-02-25T10:43:05-07:00
Authentication code: 6789
Post
by Rye » 2017-02-09T15:17:26-07:00
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
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2017-02-09T15:30:28-07:00
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.
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2017-02-09T15:59:05-07:00
What is your IM version and platform? Please always provide that when asking questions, since syntax may differ.
Rye
Posts: 158 Joined: 2013-02-25T10:43:05-07:00
Authentication code: 6789
Post
by Rye » 2017-02-10T00:54:42-07:00
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