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
VB Interface and Capturing STDERR
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: VB Interface and Capturing STDERR
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.
snibgo's IM pages: im.snibgo.com
Re: VB Interface and Capturing STDERR
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.