I installed all the libmagick-dev packages (magickwand, magick++, etc.) in Ubuntu 16.04 but I don't know where the library is... So I haven't included it to my C program. I need to use the pixel level functions for a project I'm developing.
When typing 'locate libmagick', I just get the /usr/share/doc stuff. It's the docs, not the libraries.
I need to include the .h files to my program so I can manipulate images. At the moment, I'm making tests for the image manipulations (simple programs that are in the imagemagick.org site which use the magickwand API)... But that's a thing I don't know how to do...
Where is the library? That's a first step.
Installed -dev Packages:
I also installed the libmagickwand-dev package, though apt says it's a transitional package that could be removed... I've read that those packages would be enough, but it seems it's not... Thanks for your replies.
On a Ubuntu/Debian system, the libraries are usually under /usr/lib
, or a subdirectory managed by the package installer + system architecture.
You can find them with...
find /usr/lib -name 'libMagick*'
The actual location is not terribly important as you should be leveraging pkg-config
, or MagickWand-config
utility for the required CC + LD flags.
For example
pkg-config --cflags --libs MagickWand
#=> -fopenmp -I/usr/include/ImageMagick -lMagickWand -lMagickCore
or
MagickWand-config --cflags --libs
#=> -fopenmp -I/usr/include/ImageMagick
# -lMagickWand -lMagickCore
So a simple MagickWand test can be something like...
// test.c (creates a single rose.bmp image for testing)
#include <wand/MagickWand.h>
int main()
{
MagickWandGenesis();
MagickWand *test = NewMagickWand();
MagickReadImage(test, "rose:");
MagickWriteImage(test, "rose.bmp");
DestroyMagickWand(test);
MagickWandTerminus();
return 0;
}
And can be compiled with..
cc -o make_rose_image $(pkg-config --cflags --libs MagickWand) test.c