Do I need to install ImageMagick to use C++ API?

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
xinito

Do I need to install ImageMagick to use C++ API?

Post by xinito »

I have a computer that doesn't have ImageMagick installed. I tried to copy all DLLs to that computer, but it wouldn't work. Has anyone suceeded using ImageMagick C++ APIs without installing the ImageMagick?

Thanks
xinito

Post by xinito »

I compiled a executable using ImageMagick API. I tried to package the exe and dlls to a computer that has no ImageMagick installed, but it won't work.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

The ImageMagick binaries requires Window registry entries to work properly. To remove this dependancy, compile ImageMagick from the "static" project. Next move all the programs, DLL's, and configuration files to the same directory. ImageMagick will then look in the same directory it finds the executables for any files it needs permitting you to easily redistribute ImageMagick with a minimum of fuss.
Booomy

Post by Booomy »

Hi!
I wondered what exactly you mean with the "static" project because I've got the same problem. I compiled my project, moved all dlls and config files to my directory where my .exe file is but it still doesn't work.
Do you have any suggestions?

Ben
xinito

Post by xinito »

i am the author of the original post. I tried what Magick admin suggested that to build a static, though not sure I did what s/he meant. But then I cannot find the "include". After I painfully locate each header file, it still didn't work.

I wonder if there is anyone in the worl who has succeeded in deploy a C++API exe without installing magick. Two of my colleagues tried and failed too. :-(
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

This worked for us. Run the configure program and choose a static build (static multi-threaded runtime). If you edit magick-config.h do not define UseInstalledImageMagick. Next build the project. You will find all the files in the folder VisualMagick/bin. Copy this files to where-ever you want on your system. This should be sufficient to run the command-line programs such as convert or identify. For development, copy magick/*.h, wand/*.h, and Magick++/lib/Magick++/*.h to this same folder. You can exclude all headers that end in -private.h. Also copy VisualMagick/lib/* to the folder. These are the libraries you need to link to. If you do not need the command line programs you can remove them from your folder (e.g. convert.exe, identify.exe, etc).
Booomy

Post by Booomy »

K, it doesn't work yet...
I copied the files from the directories you named into a directory I called INCLUDE and included this directory when I compiled my imageMagick project within Visual Studio 8.
First of all:
When I copy the files magick/*.h into my INCLUDE folder and then also copy the files from wand/*.h, there are some files overwritten since they exist in magick/ as well as in wand/. The same problem occurs when I copy the files from Magick++/lib/Magick++/ and in there is also the image.h which has a different size than the one which is overwritten.
Which are the files I should use now?
Second:
I can compile the program with the new INCLUDE folder but I get a runtime error when image.read() is called.
Maybe it's a bit more specific problem which may occur cuz of the call of image.read(). Was just an idea of mine...

Btw: Thanks for your patience, I feel a bit like a noob with this whole ImageMagick thing and I appreciate every help I get.

Ben
xinito

Post by xinito »

I tried again. the same problem as other people had. I wonder how Magick Admin made it to work. Is it possible that someone give us a detailed instructions on how to make it work? Thanks a lot.
dennis2society

Post by dennis2society »

i have managed to build a static linked application that was using
my self-compiled multi-threaded static magick-libs. i also had to comment
out or #undef the HasXML, HasWMFlite and HasJP2 entries in
magick-config.h to get it linked with my own project.
i had to ignore the msvcrt.lib, too.
unfortunately i am using other libraries that won't link to a mutli-threaded-
non-dll project.
so i am currently thinking of building the dlls from source but
i have already spent several days in vain on getting the project running
with self-compiled dlls, so there might be missing those mysterious
registry-entries again...
shouldn't it be possible to use the self-compiled dynamic-multithreaded
runtimes instead WITHOUT adding any entries to the registry?

[edit]
i have finally managed to build a small example-application that could
use imagemagick/magick++ without having the binary package installed.
to do so, i built the static multi-threaded libs from the imagemagick
sources and made a DLL that is statically llinked to the magick-libs (i know
how silly this sounds), containing the function that finally calls the
magick++-routines. now i can call the function from the dll from
any application without having imagemagick installed and without needing
any magick-libs or headers in the project.
this might be a weird work-around but it works for me until now and i will
find out, if i can wrap all my functions that use use imagemagick into
that DLL.
btw. my sample-application currently only opens an image, flips it and writes
the result back to disk and the static DLL is already at 3.5mb ;)
rajeevraina
Posts: 6
Joined: 2017-03-02T04:42:11-07:00
Authentication code: 1151

Re: Do I need to install ImageMagick to use C++ API?

Post by rajeevraina »

Hi

I am struggling to get it right.

Would you be kind enough to help me?

May I have your working sample application? OR Steps to get started.

I need to use the ImageMagick in my existing VS2008 project.

Please help
Post Reply