Does anyone have any ideas on why this code does not work? Doing this by command line works. I have the current version of IM loaded and set in the references.
Dim imgobj As MagickImage
Dim strDPI As String
Dim strFile As String
strFile = "J:\RCTAPE\AWM4\Jpeg\26\9\19\0001.jpg"
Set imgobj = New MagickImage
strDPI = imgobj.Identify("-format", "%x", strFile)
Set imgobj = Nothing
Using Identify in VBA
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Using Identify in VBA
It might help if you'd said what it was doing wrong. Error message? Nothing at all?Does anyone have any ideas on why this code does not work?
However, if this was C, I would say that you have to escape the backslashes in the filename string:
Code: Select all
strFile = "J:\\RCTAPE\\AWM4\\Jpeg\\26\\9\\19\\0001.jpg"
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.
See my message in this topic for a link to a zip of all the files.
Re: Using Identify in VBA
Thanks - good point on the error message. It was a run-time error of "operating system exception". But the problem looks like it is in the current vertion of IM (ImageMagick-6.4.8-9-Q8-windows-dll). I rolled back to version 6.4.0-6-Q8 and it works perfectly.
Re: Using Identify in VBA
Install the Microsoft Visual C++ 2008 Redistributable Package. That will most likely solve your problem.
Re: Using Identify in VBA
Thanks - I'll try that one later. But why would installing the Microsoft Visual C++ 2008 Redistributable Package help with a VBA utilisation?