Jump to content

ImageMagick - Image Comparison


Recommended Posts

Hello,

I have successfully used the Image Magick object to convert an image into another format: 

Func _ImageMagick_Convert($infile, $outfile)
local $o_object;
local $rc;


$o_object = ObjCreate("ImageMagickObject.MagickImage.1")
If Not IsObj($o_object) Then
Return 0
endif


$rc = $o_object.Convert($infile, $outfile)


Return 1
EndFunc

I now wish to use Image Magick's compare functionality to obtain an 'overall image distortion'. I have found the code for this here: 

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

However, I am unable to get the code to work:

Func _Compare_Image($fileOne, $fileTwo, $result)
local $o_object;
local $rc;


$o_object = ObjCreate("ImageMagickObject.MagickImage.1")
If Not IsObj($o_object) Then
Return 0
endif


$rc = $o_object.Compare("-metric", "PSNR", $fileOne, $fileTwo, $result)


Return $rc
EndFunc




$test = Call("_Compare_Image", "Sample One.png", "Sample Two.png", "Result.png")


ConsoleWrite($test)

I am not sure how to pass the -metric PSNR method.  Can anyone help? 

 

Edited by JoelH
Link to comment
Share on other sites

  • 3 months later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...