Getting no feedback from compare command.

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Bluehawk

Getting no feedback from compare command.

Post 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...
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: Getting no feedback from compare command.

Post 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
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
Bluehawk

Re: Getting no feedback from compare command.

Post by Bluehawk »

I tried but it didn't work.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Getting no feedback from compare command.

Post by fmw42 »

in command line

compare -metric rmse image1 image2 null:

returns to terminal
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Getting no feedback from compare command.

Post 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 - ...
Bluehawk

Re: Getting no feedback from compare command.

Post 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)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Getting no feedback from compare command.

Post 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.
Bluehawk

Re: Getting no feedback from compare command.

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Getting no feedback from compare command.

Post 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:")
Post Reply