Page 1 of 1

Got things to work with c# on win 7 64 bit

Posted: 2010-11-22T15:24:22-07:00
by jmaeding
There seems to be a lack of examples for calling the imagemagickobject library from c#.
So hopefully this will help others.

I am using VS 2008 on windows 7 64 bit.
I had the 32 bit of IM installed, and the dll referenced, but was getting the error where it could not make the object at runtime.
Seems that is well understood as I was calling a 32 bit dll from a 64 bit prog.

I then reomoved IM and installed the 64 bit version and referenced the new dll.
I think the install registered the new imagemagickobject dll, but I did it anyway and even checked the registry to see that it worked.
Of course, if you are on 32 bit, just use 32 bit install...

Then it took me a while to get the identify command to work. The initial problems I had with 32 bit dll confused me as to if I was creating the right object.
Turns out the examples out there were right, use ImageMagickObject.MagickImage.

Then had thought the filename went first in the params list, but it goes last. I should have known on that.
Anyway, if you reference the dll, and use this code, you should get a valid return:

ImageMagickObject.MagickImage img = new ImageMagickObject.MagickImage();
object[] args = new object[] { "-format", "%r", origName };
object result = img.Identify(ref args);

so that is working so far. Not that complicated once I was done, but the other examples never mention 64 bit issues or show actual c# code.
thanks

Re: Got things to work with c# on win 7 64 bit

Posted: 2011-02-14T17:06:46-07:00
by aya
Please help...can you post more details?

A link to what you downloaded to get the 64-bit dlls? I've downloaded the installer, but didn't get the ImageMagickObject.dll...

Thanks!

Re: Got things to work with c# on win 7 64 bit

Posted: 2012-09-26T06:37:46-07:00
by deadlyfingers
Just to recap steps for everyone:

1. Install ImageMagick for Windows
2. In Visual Studio project right-click 'References' and select 'Add Reference".
3. Under the 'COM' tab, select 'ImageMagickObject' to add it.
4. Now in Visual Studio you should now be able to reference it...
using ImageMagickObject;