Page 1 of 1

VB Interface and Capturing STDERR

Posted: 2010-04-15T09:10:22-07:00
by billbell52
The compare command outputs the location info to STDERR. So the command line below works perfectly. The location info goes into loc.txt (2> sends STDERR to loc.txt). I have coded this up to use the windows shell command and it runs perfectly.

compare -metric rmse -dissimilarity-threshold 1 c:\temp\main.bmp c:\temp\sub.bmp c:\result.bmp 2>c:\temp\loc.txt

I want to test using the windows shell approach to using the VB interface. I am using VBA in Excel. The code below works but I have no clue how to get STDERR. Everything I have tried has not worked. Any ideas?

Sub TestCompare()

Dim imgObj As Object
Dim loc As Variant
Dim mainImage As String
Dim subImage As String
Dim resultImage As String

mainImage = "C:\temp\main.bmp"
subImage = "C:\temp\sub.bmp"
resultImage = "C:\temp\result.bmp"

Set imgObj = CreateObject("ImageMagickObject.MagickImage.1")
loc = imgObj.Compare("-metric", "rmse", "-dissimilarity-threshold", "1", mainImage, subImage, resultImage)
Set imgObj = Nothing
End Sub

Re: VB Interface and Capturing STDERR

Posted: 2010-04-15T09:29:38-07:00
by snibgo
You are asking a Visual Basic question on an ImageMagick forum. I don't know the answer, but an internet search turns up many possibilities.

Re: VB Interface and Capturing STDERR

Posted: 2010-04-15T10:18:07-07:00
by billbell52
It is the DLL provided with the ImageMagick Windows binary. It is a question on the dll not VBA. I am not sure who provides the dll for the ImageMagick binary Windows install. I did tons of googling and could not find an answer.