ImageMagickObject returns alwas null.

  • Chris

    Chris - 2010-04-30


    I don't get the GraphicsMagick to work in a C# .NET ConsoleApp in VS2008 (x86) Full install running Windows 2003 R2 (x86).

    I've a reference ImageMagick.NET and ImageMagickObject.DLL in my App what went succesfull. With both I could see the functions and methodes.
    But then, I started the App and got the following error: "failed to load in the 'Load' binding context of the AppDomain with ID 1. The cause of the failure was: System.BadImageFormatException: Could not load file or assembly 'ImageMagickNET, Version=1.0.3771.21327, Culture=neutral, PublicKeyToken=null' or one…" when I write the ImageMagick.InitializeMagick(path) methode.
    So I went to GraphicsMagick, where I saw the speed difference between the two. So I decided to use GraphicsMagick instead and referenced the ImageMagickObject.dll. This went succesfull too. I also installed the biniaries to test it why it doesn't work.
    But then I wrote the following code what always returns null what I think it shouldn't:

    ImageMagickObject.MagickImageClass imo =  new ImageMagickObject.MagickImageClass();
    object test = new object {"-version"};
    imo.Identify(ref test);

    This returns always null, and get no exceptions howso ever.

    I've tried already many things en read so many articles/manuals, but still no succes. When I folow the manual of GraphicsMagick it won't compile either, it is missing includes or something, winres.h I've found that file and copied it into the VisualMagicks\ImgMagObj folder, when the this error was gone it came with another one, atlbase.h not found when compiling.

    Please tell me what I'm doing wrong here to get it to work. It shouldn't be that difficult right?


  • Bob Friesenhahn

    Bob Friesenhahn - 2010-05-01

    It is quite possible that I broke something in ImageMagickObject while creating GraphicsMagick 1.3.  I did disable/break one or two data communication mechanisms used by ImageMagickObject because they interferred with other operation (depended on strange "back door" side-effects), and I did not quite understand how these parts worked.  This may be responsible for identify returning nothing at all.  I don't know much about ATL or COM objects.
    Note that there are two ImageMagickObject source trees in GraphicsMagick.  The latest one is under contrib/win32/ATL7.
    For GraphicsMagick 1.4 (subsequent to 1.3.X releases), the parts dependent on ATL and MFC will be removed because these depend on closed-source proprietary libraries, and it seems to violate both Microsoft Visual Studio and GPL licenses. Regardless, if there are working fixes, I am happy to apply them to the source base.  It is only distribution of binaries which is the issue.
    Thankfully, I have not experienced any problems with getting ImageMagickObject to build with various Visual Studio Professional versions.


  • Chris

    Chris - 2010-05-01

    Hi Bob,

    Thanks for your reply.
    I used the ImageMagickObject source under contrib/win32/ATL7 to build the DLL, what is written in the manual.

    But maybe you do know a way to make it working in a C# .NET Window App/ C# library, C# wrapper or something?
    I tried already the project named "ImageMagick.NET" on, what uses ImageMagick 6.5.3, but I can't make that working either, the source will build succesfull. And when I'm not mistaken is written in C++ .NET, so when I copy the latest source files to it, it should build the new DLL. But somehow it will won't run in my C# programm will it is missing a assembly or something.
    Is there a way you can help me with this, so we have a working C# .NET example and add it to the source base.

    Or maybe I'm missing some important DLLs, while ImageMagick.InitializeMagick(path) methode will throw the error: Could not load file or assembly 'ImageMagickNET, Version…
    What are the DLLs named you need to add to your project bin folder, so it don't misses assemblies?


  • Meron Lavie

    Meron Lavie - 2011-08-29

    Has ANYONE gotten ImageMagickNET to work on VS2008? I see lots of people giving advice to those who have failed, but i see no evidence of anyone ever having succeeded PERSONALLY.



Log in to post a comment.