VBA excel compare Image

ImageMagickObject is a Windows COM+ interface to ImageMagick. COM+, Visual Basic, and Delphi users should post to this discussion group.
Post Reply
dreamchaser
Posts: 2
Joined: 2017-07-22T15:11:13-07:00
Authentication code: 1151

VBA excel compare Image

Post by dreamchaser » 2017-07-23T03:56:41-07:00

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

User avatar
fmw42
Posts: 22103
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: VBA excel compare Image

Post by fmw42 » 2017-07-23T12:08:02-07:00

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/

dreamchaser
Posts: 2
Joined: 2017-07-22T15:11:13-07:00
Authentication code: 1151

Re: VBA excel compare Image

Post by dreamchaser » 2017-07-23T12:53:21-07:00

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

Post Reply