IM/MW installation/linking issues

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
rasputin

IM/MW installation/linking issues

Post by rasputin »

Hi
I am trying to install ImageMagick to use with MagickWand under Visual Studio 9.0.
I began by getting a binary installer and getting ImageMagick to work. That worked OK. I tried running a program containing the example code wand.c and found this install had come with no source files.
I re-downloaded ImageMagick 6.6.2, and managed to find a file which does come with some .c and .h files in folders called /wand and /magick.
It also comes with a file called Install-windows.txt which talks all the time about "VisualMagick" but I have nothing called that. Nor does the whole ImageMagick-6.6.2-6 tree include any .dsw or .sln files. (It talks about a configure directory containing configure.sln ???).

I tried just to copy the /wand and /magick folders to my /include folder, but it then won't compile a project with the wand.c code because it says an error about not finding a ghostscript header file. I cannot even find on the web a source code for ghostscript that is not a tarball (*and I never wanted to install ghostscript*). I commented out the hasGS #define in magick-config.h but this had no effect! Clearly there is something else that needs rebuilding first (???).

My preferred way of doing things would be to make ImageMagick a static library that lives in my application. I thought I might struggle a bit with linking it in VS (if there is a guide to that, rather than just some command-line compiler switches, that would also be useful), but it's seeming like I can't get even that far...
Any help appreciated.

Warwick
rasputin

Re: IM/MW installation/linking issues

Post by rasputin »

Further to that.

I eventually discovered that the sourceforge mirror of ImageMagick includes this VisualMagick part. Apparently I then built it, but not sure after all what I achieved by that.

Coming back to my effort of just copying /wand and /magick into my /VC/include directory, I installed ghostscript from executable and unsurprisingly it made no difference. So I just deleted the #include for ghostscript in delegate.h, and did likewise for a couple of other similar errors.
Had then to modify the example code a little to avoid compiler errors for undeclared variables - relevant bit of my code now looks like

Code: Select all

	MagickWand * magick_wand;
	int status;

	MagickWandGenesis();
	magick_wand=NewMagickWand();  
	status=MagickReadImage(magick_wand,"doxygen.png");
	if (status == MagickFalse)
    ThrowWandException(magick_wand);
  /*
    Turn the images into a thumbnail sequence.
  */
	MagickResetIterator(magick_wand);
	while (MagickNextImage(magick_wand) != MagickFalse)
    MagickResizeImage(magick_wand,106,80,LanczosFilter,1.0);
  /*
    Write the image then destroy it.
  */
	 status=MagickWriteImages(magick_wand,"bonk.png",MagickTrue);
	if (status == MagickFalse)
		ThrowWandException(magick_wand);
	magick_wand=DestroyMagickWand(magick_wand);
	MagickWandTerminus();
within a Windows program that is just the standard one that VS creates when you create a new Win32 project. I then get a linking error, as I really do not know how to link to the ImageMagick library, or where it lives.

The install-windows.txt file says
You can feel free to pick any of the standard utilities, tests, or demo
programs as the basis for a new program by copying the project and the
source and hacking away.
However, I don't feel free to do that, because for one thing I'm trying to write a Win32 application (I want to see my plots on screen before I save them, and I already know how to do that with Windows bitmaps, I don't want to do anything differently).

I thought the idea of the VisualMagick bit was to compile a static library file that I could then link to, but it seems to compile bunches of utility executables.

Well anyway, if anyone knows a simple way to link an ImageMagick static library into a VS Win32 project, please help.
Post Reply