Jump to content
Sign in to follow this  
JoelH

ImageMagick - Image Comparison

Recommended Posts

JoelH

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

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  

×