I am thinking about starting a new project which involes image manipulation.
After a search around for some libraries ImageMagick's Magick++ kept popping up.

Thing is, before I start looking into how to install it, I'd like to know if it will suit my purpose and hoping someone here has experience with it and can provide some information.

My goal is to create a dll with the ImagMagick functionality in it among some of my own wrapper functions.

My question is, can I link this library statically or will I or a user need to have a bunch of Magick dll's along side it after production.

Thank's for reading, any input is very welcome.

Recommended Answers

All 12 Replies

hiiiiiiiiiiiiiiiii

You can.

However, what do you actually need from the image library? If you just need to be able to read images into memory, and write them again afterwards, and you'll do the manipulation yourself, ImageMagick might be a bit overpowered. There are many, many image libraries available.

I will be creating animated gifs from various inputs. I could find much info on how to go about that myself.

I'd go with CImg on this one, then. You want to link statically; well, CImg is just a single header for you to #include, which may well meet your needs even better.

Using CImg, you make a CImg for each frame. For example:

 CImg<float> image_one("first_frame.png");
 CImg<float> image_two("second_frame.png");

Then you put them in a list of CImg objects, for which CImg has a type, CImgList.

Then call save_gif_external on that CImgList, and you're done.

That looks pretty simple, I'm surprised it never came up in my searches.

I've added Magick++ for now and that seemed really simple too.

using (MagickImageCollection collection = new MagickImageCollection())
            {
                for (int i = 1; i < 101; i ++)
                {
                    collection.Add("image" + i.ToString() + ".bmp");
                }

                collection.Write("Output.gif");
            }

Which creates a gif from 100 images.
I will test CImg if I cannot figure out how to get the gif to appear at a natural speed, for example capturing images from the screen while working, and then getting the gif to play back at the same speed.

In fact I will try it either way I think so I can compare the results.

Thanks.

(edit)

Actually I'm a bit dopey, this was not Magick++ it was what I tried late last night and was Magick.Net in C#.

Apologies.

I think CImage might actually need another library to work with gifs.

There really is not that much info on save_gif_external, but I think the external means external library.

int _tmain(int argc, _TCHAR* argv[])
{
    CImg<float> image_one("C:\\Documents and Settings\\SUSAN\\Documents\\image1.bmp");

    CImg<float> image_two("C:\\Documents and Settings\\SUSAN\\Documents\\image2.bmp");

    CImgList<float> image_list(2);

    image_list(0) = image_one;
    image_list(1) = image_two;

    // all appears fine until here.
    image_list.save_gif_external("C:\\Documents and Settings\\SUSAN\\Documents\\myanim.gif");


return 0;
}

The error is thrown on line 48183 of CImg.h

if (!file)
        throw...

And is CImgIOException

"save_gif_external(): Failed to save file 'C:\Documents and Settings\SUSAN\Documents\myanim.gif' with external command 'convert'."

I hope I'm wrong about the external library though.

Suzie I did some checking and it looks like load_gif_external() uses ImageMagick or GraphicsMagick's external tools. save_gif_external() does not say that it does but you would think the load and save use the same mechanics.

I thought as much, I've spent around 4 hours all in all trying to work out how to install Magick++ and it turns out I downoalded a zip instead of an exe and it's why I could not find configure.exe in the archive :(

The saga continues.

That's odd. If you have ImageMagick installed, it shouldn't have any trouble. convert is an imagemagic command-line program. If you simply enter convert on the command-line, does it find the imagemagick tool?

It is odd, I'm going to leave it for a while because I'm getting nowhere fast.

Everywhere I look for info, it says to simply go to the VisualMagick\Configure folder. THing is I have downloaded virtually every windows x86 package I can find, and none of them either in a zip or after running the setup exe has a VisualMagick folder to go to.

One piece of info said to build, you use a makefile, and I don't even know what they are. there are some in the files but with .am and .in extensions.

I tried to open one with VS but it errored out and no files were converted, cried about incorrect syntax or something.

I probably need some quality sleep.

I'm abandoning this, looks like I'd have to have command line tools along with my app.

Whether that is true or not, it's taking up far to much of my time for what it's worth.

Not totally given up, just having a go with Magick.Net instead.

Thanks for all your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.