Gimp-like Subtract

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?".
Post Reply
blackswan
Posts: 4
Joined: 2012-11-03T10:49:14-07:00
Authentication code: 67789

Gimp-like Subtract

Post by blackswan »

I noticed, that "difference" of two images looks very alike with Gimp's one
But "subtract" operation result is not even near Gimp's version. Is it possible somehow to do it the same way as Gimp does?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Gimp-like Subtract

Post by snibgo »

At least for greyscale images, "MinusSrc" is the same as Gimp's "Subtract".
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Gimp-like Subtract

Post by fmw42 »

What command did you use in IM? What version of IM? What platform? Which way did you subtract them in GIMP? The issue is whether you did (image1 - image2) or (image2 - image1).

Subtract in IM for (image1 - image2) is done by (swapping the order of the two inputs if using convert and not swapping if you use composite)

convert image1 image2 +swap -compose minus -composite result

or

convert image2 image1 -compose minus -composite result

or using the old composite

composite -compose minus image1 image2 result

See
http://www.imagemagick.org/Usage/compose/#compose
http://www.imagemagick.org/Usage/compose/#minus

Also in IM difference gives the absolute value of the difference. Not sure if you want that or not?

convert image1 image2 -compose difference -composite result
Post Reply