Link to home
Start Free TrialLog in
Avatar of shawnkimble
shawnkimbleFlag for United States of America

asked on

Imagemagick ActiveX error 429

Here is my VBA code:
Sub Test2()
    Dim MGImg As New MagickImage
    Dim Source As String
    Dim Dest As String
    Source = "C:\3.Store\test1.jpg"
    Dest = "C:\3.Store\vbout.jpg"
    MGImg.Convert Source, "-crop", "500x500+10+10", Dest    'Error occurs here
End Sub

I get a "Run-time error'429': ActiveX component can't create object"

The DLL for Imagemagick is registered as checking the Registry, I find "ImageMagickObject.dll" in two places, both with the same data value of "C:\Program Files\ImageMagick-6.7.9-Q8\ImageMagickObject.dll"

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{9AA0FC6A-63C7-3632-BD6B-7CAF646E51A0}\1.0\0\win32

HKEY_CLASSES_ROOT\TypeLib\{9AA0FC6A-63C7-3632-BD6B-7CAF646E51A0}\1.0\0\win32

I can also confirm the dll file is in the proper location
C:\Program Files\ImageMagick-6.7.9-Q8\ImageMagickObject.dll

When I try to un-register or re-register via
c:\ regsvr32 ImageMagickObject.dll
I get the error:  "LoadLibrary("ImageMagickObject.dll") failed - The specified module could not be found."

If I perform the regsvr32 command inside the ImageMagic folder, or reference the path directly, I get the same error.

ImageMagic does work fine from the cmd line or from a batch file, I just can't call it directly from VBA.

What else could I check to fix the dll link for my project?  Could something else be triggering the error?

I also read a comment about how one aspect of the COM object being corrupt could corrupt the entire dll.  I've tried the 8bit static and the 16 bit dll from ImageMagick, same issue.
Avatar of shawnkimble
shawnkimble
Flag of United States of America image

ASKER

The reason I'm writing the VBA call was because I was unable to find a way to get the output of the ImageMagick's compare statement to a variable.  

Finally found this link that explains how to pipe the output in a batch file
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=12618&start=0

Format to pipe output via batch to txt file:
compare -metric ae out3.jpg out4.jpg null: 2>output.txt

The non-obvious need for the "2" for windows users, is due to Unix

Still would like to solve above problem, but I now have a work around.
Avatar of RobSampson
Hi, I've used this line to create the object in VBScript:
Set objIM = CreateObject("ImageMagickObject.MagickImage.1")

In Excel, I was able to open the VBA Editor, click Tools --> References, add ImageMagickObject 1.0 Type Library, then run the same line as you to create the object.

Regards,

Rob.
After some digging, and the use of "Dependency Walker" & "regDLLView" I can confirm that ImageMagic is not currently registered.  The registration fails because "Dependency Walker" finds that:

"Error: At least one required implicit or forwarded dependency was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module."

All missing modules are of the format "IM_MOD_RL_?????.DLL.  There are about 120 of them.  Hopefully I can find the DLL that contains these.  Anyone?

IM_MOD_RL_AAI_.DLL
IM_MOD_RL_ART_.DLL
IM_MOD_RL_AVS_.DLL
IM_MOD_RL_BMP_.DLL
IM_MOD_RL_BRAILLE_.DLL
IM_MOD_RL_CALS_.DLL
IM_MOD_RL_CAPTION_.DLL
IM_MOD_RL_CIN_.DLL
IM_MOD_RL_CIP_.DLL
IM_MOD_RL_CLIP_.DLL
IM_MOD_RL_CLIPBOARD_.DLL
IM_MOD_RL_CMYK_.DLL
IM_MOD_RL_CUT_.DLL
IM_MOD_RL_DCM_.DLL
IM_MOD_RL_DDS_.DLL
IM_MOD_RL_DEBUG_.DLL
IM_MOD_RL_DIB_.DLL
IM_MOD_RL_DNG_.DLL
IM_MOD_RL_DPX_.DLL
IM_MOD_RL_EMF_.DLL
IM_MOD_RL_EPT_.DLL
IM_MOD_RL_FAX_.DLL
IM_MOD_RL_FD_.DLL
IM_MOD_RL_FITS_.DLL
IM_MOD_RL_GIF_.DLL
IM_MOD_RL_GRADIENT_.DLL
IM_MOD_RL_GRAY_.DLL
IM_MOD_RL_HALD_.DLL
IM_MOD_RL_HDR_.DLL
IM_MOD_RL_HISTOGRAM_.DLL
IM_MOD_RL_HRZ_.DLL
IM_MOD_RL_HTML_.DLL
IM_MOD_RL_ICON_.DLL
IM_MOD_RL_INFO_.DLL
IM_MOD_RL_INLINE_.DLL
IM_MOD_RL_IPL_.DLL
IM_MOD_RL_JBIG_.DLL
IM_MOD_RL_JP2_.DLL
I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
IM_MOD_RL_TIM_.DLL
IM_MOD_RL_TTF_.DLL
IM_MOD_RL_TXT_.DLL
IM_MOD_RL_UIL_.DLL
IM_MOD_RL_URL_.DLL
IM_MOD_RL_UYVY_.DLL
IM_MOD_RL_VICAR_.DLL
IM_MOD_RL_VID_.DLL
IM_MOD_RL_VIFF_.DLL
IM_MOD_RL_WBMP_.DLL
IM_MOD_RL_WPG_.DLL
IM_MOD_RL_X_.DLL
IM_MOD_RL_XBM_.DLL
IM_MOD_RL_XC_.DLL
IM_MOD_RL_XCF_.DLL
IM_MOD_RL_XPM_.DLL
IM_MOD_RL_XPS_.DLL
IM_MOD_RL_XTRN_.DLL
IM_MOD_RL_XWD_.DLL
IM_MOD_RL_YCBCR_.DLL
IM_MOD_RL_YUV_.DLL
Hi, I can't remember exactly, but I downloaded the program from here:
http://www.imagemagick.org/script/binary-releases.php#windows

and I'm pretty sure I got the top one:
ImageMagick-6.7.9-0-Q16-windows-dll.exe

That installed the ActiveX controls required.  After that, you should be able to add the Reference in the VBA Editor.

Regards,

Rob.
ASKER CERTIFIED SOLUTION
Avatar of shawnkimble
shawnkimble
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That's an old version. Grab a newer version from the link I posted.  Glad you got it sorted anyway.
I solved the problem.