Page 1 of 1

Compare using COM from VBS returns a null value?

Posted: 2011-12-22T14:37:34-07:00
by dmozealous
Hoping someone can help me out.

This is essentially what I am doing. Using COM to do an image comparison between two images. The problem is myFuzz isn't returning anything when I use COM via VBS. Any idea why? When I do an img.Convert I get a string back, just not with img.Compare.

Set img = CreateObject("ImageMagickObject.MagickImage.1")

myFuzz = img.Compare("-metric","AE", "image1.png", "image2.png", "output.png")

MsgBox myFuzz

Any help would be much appreciated.

Note, the output.png is being created, so I know I am not getting an error.

Re: Compare using COM from VBS returns a null value?

Posted: 2011-12-22T15:44:42-07:00
by fmw42
text comparison results go to standard error. redirect you results to 2>&1. at least that is what I do in command line to put the results into a variable on my Mac/unix

Re: Compare using COM from VBS returns a null value?

Posted: 2011-12-22T16:52:58-07:00
by dmozealous
fmw42 wrote:text comparison results go to standard error. redirect you results to 2>&1. at least that is what I do in command line to put the results into a variable on my Mac/unix
Thanks for the help..

That works great from a command line, but not from the COM component.

Using your suggestion, this is what I changed my script too:

Code: Select all

Set img = CreateObject("ImageMagickObject.MagickImage.1")
myFuzz = img.Compare("-metric","AE", "image1.png", "image2.png", "output.png", "2>&1")
MsgBox myFuzz
This is the equivalent of running this from a command line:
compare -metric AE image1.png image2.png output.png 2>&1

Looks like this guy is having the same problem:
viewtopic.php?f=1&t=17197&start=0