Imagemagick and c++

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
Site Admin
Posts: 10844
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-10-17T11:33:00-07:00

ImageMagick includes demo projects. Check c:\Program Files\ImageMagick-6.3.0-Q16\Magick++_demos and try the button program.
Last edited by magick on 2006-10-17T11:43:00-07:00, edited 1 time in total.

Posts: 1017
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo » 2006-10-17T11:34:10-07:00

[EDIT: Magick beat me to it and have a better idea - delete this if it's redundant]
The windows installer does not by default install the headers and libraries you need. I think you can run the installer again and when you get to the "Select Additional Tasks" window, select only the "install development and header libraries for C and C++" option and then run it. Your ImageMagick-6.3.0-Q16 directory should then have include and lib directories. If all else fails, uninstall ImageMagick and then reinstall with this option selected as well.

Once you've done that, you have to point the compiler at the include and lib directories. This will depend upon the compiler/IDE you are using. I'm using MS 2003 version of Visual C++ .net. I also use C rather than C++ but the steps are probably similar anyway:
Right click on the project name and select Properties and then modify the following options:
- In C/C++|General: In "Additional Include Directories" add the path to your include directory - something like "C:\Program Files\ImageMagick-6.3.0-Q16\include"
- In Linker|General: Add the additional library directory C:\Program Files\ImageMagick-6.3.0-Q16\lib
- In Linker|Input: Add the Additional Dependencies CORE_RL_magick_.lib CORE_RL_wand_.lib CORE_RL_Magick++_.lib

As I say, I don't use C++ so in that last step you might be able to get away with specifying only CORE_RL_Magick++_.lib. If that fails add the other two and try again.

BTW. The Q16 version is slower than Q8 and uses a lot more memory per image. If you don't have a specific need for Q16 precision, and especially if you're just playing around, you might find Q8 more suitable and certainly faster while you're learning (and if you do change it, the pathnames to the include and lib directories will of course be different).

[EDIT] corrected the references to CORE_RL_Magick++_.dll which should be CORE_RL_Magick++_.lib
Last edited by el_supremo on 2008-07-26T08:01:09-07:00, edited 4 times in total.

Posts: 1017
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo » 2006-10-21T08:35:15-07:00

> I blindly copy&pasted those libs and didn't notice that the last one should also have the ending .lib instead of .dll

Sorry about that. I have edited my post to correct the references to .dll that should be .lib just in case someone else uses that info.


Post Reply