Page 1 of 1

Comparing images to know if they are visually identical using COM Interface in VBScript

Posted: 2017-08-23T05:56:18-07:00
by GTAVLover
Hello, I want to compare visually similar images and get difference number in VBScript using COM Interface of ImageMagick.

I tried following command and it worked fine in Windows Command Processor:

Code: Select all

convert -metric PHASH C:\A.bmp C:\B.bmp NULL:
It gives the result 1.00 as it should.

But when I use following VBScript and execute it in WSH, COM interface throws the error unrecognized option "-metric PHASH".
I have ImageMagick 64-bit 7.0.2-9 Q16 installed in my 64-bit system.

This is the VBScript:

Code: Select all

Dim IM: Set IM = WScript.CreateObject("ImageMagickObject.MagickImage")

Dim Result: Result = IM.Compare("-metric PHASH", "C:\A.bmp", "C:\B.bmp", "NULL:")
WScript.Echo "PHASH Comparison returned " + CStr(Result)
Please help me to get this script work as it should.

Thanks in advance.

Re: Comparing images to know if they are visually identical

Posted: 2017-08-23T07:30:33-07:00
by snibgo
You are sending an output image to "x:", an X-terminal. Do you have an X-terminal? If not, that won't work.

What do you mean by "visually similar"? Samples would help us to advise.

The simplest comparison is when the two images are the same size, and you want a pixel-by-pixel comparison:

Code: Select all

compare -metric RMSE TCL.bmp TCCL.bmp NULL:
This returns a number in parentheses like "(0.03456)" which is 0.0 if they are identical, up to 1.0 if they are entirely different.

Re: Comparing images to know if they are visually identical using COM Interface in VBScript

Posted: 2017-08-23T07:45:56-07:00
by GTAVLover
Thanks for the reply. I also like to know difference between RMSE and PHASH. I can upload samples but they have watermarks.
As I edited my question, I now succeeded doing above in command processor, now I want to do the same in VBScript.
I updated my question some time ago.

Sincerely