Page 1 of 1

VBA excel compare Image

Posted: 2017-07-23T03:56:41-07:00
by dreamchaser
Hello everyone,

For a few days that I have difficulty doing a compare using Imagemagick

My question is: I have a .jpg file inside a folder and I want to compare it with another image inside the same folder.

Ideally I wanted the program to return true if the images are identical.

I'm working on excel vba.

Has anyone tried to do something like this?

Here is My code so far:

Code: Select all



Dim img As New ImageMagickObject.MagickImage

Sub test()
    
    Dim Filepath1 As String
    Dim Filepath2 As String
    Dim result
    Filepath1 = "c:\image11.bmp"
    Filepath2 = "c:\image22.jpg"
    
    result = img.compare(Filepath1, Filepath2)
    

End Sub


Thanks a lot

Re: VBA excel compare Image

Posted: 2017-07-23T12:08:02-07:00
by fmw42
I do not know Windows or VBA.

But, you need to specify a metric. I am not sure what the default is. The result of the compare will be a value specifying the metric score. For example, with rmse, a value of 0 means perfect match. You also have to specify an output, though it can be "null:"

I recommend testing in the command line first to understand how compare works.

See
http://www.imagemagick.org/script/compare.php
http://www.imagemagick.org/Usage/compare/

Re: VBA excel compare Image

Posted: 2017-07-23T12:53:21-07:00
by dreamchaser
I tried as they had there but it always gives error when running the code.

I also tried the shell but without success.

Anyone who has ever tried to apply imagemagick to vba excel?

thanks