Jump to content
Sign in to follow this  
CableGuy

Compare Images with ImageMagick

Recommended Posts

CableGuy

Hi,

I want to compare 2 images i get from _ScreenCapture_Capture(). I search a while and read a lot about ImageMagick and i think i figured out 2 ways i can do this.

The first way could be an DllCall. The other way is the COM-Object.

First i tried the DllCall but this is not working. I´m always get an Error 1. I think there something wrong with my parameters.

Local $result = DllCall($dll, "double", "MagickCompareImages","metric","PSNR","uint",$hReference,"uint",$hImage)

COM-Object could work but it seems that he´s not accepting the variable which contains the HBITMAP returned from

ScreenCapture_Capture(). I also tried to use _GDIPlus_BitmapCreateFromHBITMAP() for this variable, with no luck. He always returns

me "The requested action with this object has failed."

$oCompareObject = ObjCreate("ImageMagickObject.MagickImage")

    $result = $oCompareObject.Compare("-metric", "PSNR", _
            $hReference, _
            $hImage, _
            "null:")

Could anyone help me to fix this problem ?

Thanks in advance

Share this post


Link to post
Share on other sites
jftuga
CableGuy

Thanks for your reply!

Calling an exe could be a solution but it is too slow for my program.

Any other ideas ?

Share this post


Link to post
Share on other sites
water

What do you want to achieve? Compare the images and check if they are equal? Or get the areas where the picture has changed?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
CableGuy

I want to check if two pictures are equal. And if they are not equal i want to get an percentages or something else for the difference between the two pictures.

Thank you

Share this post


Link to post
Share on other sites
water

I see.

Can you please tell us what you try to achieve? I mean, why do you need to compare two screenshots?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
CableGuy

i want detect changes made on my desktop. if the images are equal it´s not necessary to save the screenshot again.

Share this post


Link to post
Share on other sites
water

Changes on the desktop means: New, deleted or moved icons. Anything else? Wouldn't it be easier to monitor the icons?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
CableGuy

i´m also want to see if someone is working on my pc, starting programs, browse my files and so on....

Share this post


Link to post
Share on other sites
water

I would lock the PC so noone can work there ;)

But I think it is easier to check for Mouse moves, new tasks etc.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
CableGuy

Thanks for your suggestion.

But i would prefer to make screenshots so it´s easier to reproduce changes.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×