Page 1 of 1

create difference image using Magick++ (via PythonMagick)

Posted: 2015-04-30T12:45:34-07:00
by willjs12
Version: ImageMagick 6.8.9-8 Q16 x86_64 2014-10-23
OSX Yosemite

I'm porting some code that does image comparison from ruby to python. The images being compared are always similar in size and resolution.

I have PythonMagick successfully installed and working.

Problem: How do I compare images and output a difference image (showing different pixels in red with the similar pixels faded) with Magick++ (via PythonMagick)? Note that PyhonMagick does not expose MagickCore (as far as I can tell). I imagine I need to break it into multiple steps, but what exactly are the steps?

Command line equivalent: compare -metric AE file1.png file2.png diff.png

Ruby equivalent (via RMagick): diff_img, pixels = img1.compare_channel(img2, Magick::AbsoluteErrorMetric)

Thanks!