For my CSE 408 class, Multimedia Information Systems, we need to use an image API to complete some of our projects. ImageMagick (http://www.imagemagick.org/script/index.php) was recommended by Prof. Candan and Magick++ is the C++ api for the ImageMagick library. I spent some time getting it working in Visual Studio 2010 and it required a few more steps than the usual additional dependency paths in Visual Studio so I decided to blog them up for my group and anyone else having some trouble getting Magick++ working.
Disclaimer: I’m by no means a super-experienced programmer yet, nor am I a master of ImageMagick or Magick++. I’m sure there’s a billion ways to get ImageMagick into your program. This is just one way (the easiest I could figure out) to get Magick++ runing on my personal copy of Visual Studio 2010 for C++ coding. Hope it helps!
Step 1: Download Magick++
Under the heading, “Obtaining Magick++”, follow the “ftp” link then choose a download mirror for wherever you live. You should now see an ftp listing if you didn’t go to sourceforge or somewhere like that. Scroll down and click on the “binaries” directory and I downloaded “ImageMagick-6.8.6-9-Q16-x86-dll.exe” (6.8.6-9 was the current version at the time).
Step 2: Install Magick++
Run the .exe and next, next, next until you get to the screen below and make sure to select “install development headers for C and C++.” Also make sure to note the install path because we need that later.
Finish the installation and launch Visual Studio 2010.
Step 3: Adding Magick++ to a project
Open your project properties and at the top, set the Configuration to “All configurations” or Release(Active).
Magick++ doesn’t like to run in Visual Studio’s Debug mode so you have to build as a Release or ImageMagick won’t be happy.
In the project properties list on the left side, expand
Add the ImageMagick Include folder as an Additional Dependency. This is where you need to know where you installed ImageMagick too.
Next select “Code Generation” under the C/C++ section on the left sidebar of the project properties and ensure that “Runtime Library” is “Multi-Threaded (/MT)”
Expand the “Linker” section under C/C++ and add the lib directory for ImageMagick as an Additional Dependency (like in the image above, just “lib” instead of “include.”
Almost there.. now click on “Input” under the Linker section on the left sidebar. Add one more Additional Dependency and add these:
CORE_RL_magick_.lib CORE_RL_Magick++_.lib CORE_RL_wand_.lib X11.lib
I’m pretty sure X11.lib was part of this, but I could be wrong. It looks out of place at the moment.. Save and close your project properties!
Step 4: Adding the header and namespace
Now, you should just simply have to
using namespace Magick;
or use the individual
namespace identifiers and you should be good to go!