Page 1 of 1

Getting no feedback from compare command.

Posted: 2010-04-09T07:39:49-07:00
by Bluehawk
Hi all.

I tried a lot, but couldn't get any feedback from the code below.
The code seems to work ok because it doesn't give any error and creates the diff.png image.
But it doesn't give any feedback for debug.print
I''ve tried nearly every combination and and about to go nuts.
Can anybody help ?

PS. I'm using VBA under Access 2007

Code: Select all


Private Sub TestCompare()

Dim imgMagick
Dim strMsg As String

    Set imgMagick = CreateObject("ImageMagickObject.MagickImage.1")
    strMsg = imgMagick.Compare("-metric", "PSNR", "c:\test.jpg ", "c:\test2.jpg ", "c:\diff.png ")
    Debug.Print strMsg
    Set imgMagick = Nothing

End Sub

Thanks in advance...

Re: Getting no feedback from compare command.

Posted: 2010-04-09T08:18:11-07:00
by el_supremo
The result from the compare command is not written to the standard output but to the error output (file descriptor 2). Can you capture the error output somehow (I'm not familiar with VBA)?

Pete

Re: Getting no feedback from compare command.

Posted: 2010-04-11T15:16:17-07:00
by Bluehawk
I tried but it didn't work.

Re: Getting no feedback from compare command.

Posted: 2010-04-11T16:01:39-07:00
by fmw42
in command line

compare -metric rmse image1 image2 null:

returns to terminal

Re: Getting no feedback from compare command.

Posted: 2010-04-11T16:26:40-07:00
by magick
The compare metrics go to stderr. This permits you to pipe the output image:
  • convert -metric rmse image.png reconstruct.png png:- | convert - ...

Re: Getting no feedback from compare command.

Posted: 2010-04-12T03:00:15-07:00
by Bluehawk
Sorry but I didn't get it.
What exactly should I do to get the feedback ? Use convert after compare ?
And what does stderr mean ? (My English is not perfect)

Re: Getting no feedback from compare command.

Posted: 2010-04-12T09:35:08-07:00
by fmw42
if you supply a third image, you will not get any messages, just the difference image. But if you specify null: for the third image, then you get the metric statistics.

PS what version of IM are you using? if old, perhaps you need to upgrade.

Re: Getting no feedback from compare command.

Posted: 2010-04-12T13:22:07-07:00
by Bluehawk
Do you mean like this ?

Code: Select all


Private Sub TestCompare()

Dim imgMagick
Dim strMsg As String

    Set imgMagick = CreateObject("ImageMagickObject.MagickImage.1")
    strMsg = imgMagick.Compare("-metric", "PSNR", "c:\21.jpg", "c:\222.jpg")
    Debug.Print strMsg
    Set imgMagick = Nothing

End Sub


But I still get nothing. I'm using 6.6.1 Q16

Re: Getting no feedback from compare command.

Posted: 2010-04-12T15:27:59-07:00
by fmw42
sorry I don't use API, just command line and don't use PC, but Mac. But I presume it would be:

strMsg = imgMagick.Compare("-metric", "PSNR", "c:\21.jpg", "c:\222.jpg", "null:")