ImageMagick: MagickWand, C API for ImageMagick
Author: ImageMagick Studio LLC
Description: ImageMagick (TM) is a free software suite to create, edit and compose bitmap images. It can read, convert and write images in a large variety of formats. Images can be cropped, colors can be changed, various effects can be applied, images can be rotated and combined, and text, lines, polygons, ellipses and Bézier curves can be added to images and stretched and rotated. ImageMagick is free software: it is delivered with full source code and can be freely used, copied, modified and distributed. Its license is compatible with the GPL. It runs on all major operating systems. Most of the functionality of ImageMagick can be used interactively from the command line; more often, however, the features are used from programs written in the programming languages Perl, C, C++, Python, PHP, Ruby or Java, for which ready-made ImageMagick interfaces (PerlMagick, Magick++, PythonMagick, MagickWand for PHP, RubyMagick, and JMagick) are available. This makes it possible to modify or create images automa [cell cut: 1159 characters, first 1000 kept]
Keywords: magickwc, api, for, imagemagick, ImageMagick, PerlMagick, Magick++, Image, Magick

The MagickWand API is the recommended interface between the C programming language and the ImageMagick image processing libraries. Unlike the MagickCore C API, MagickWand uses only a few opaque types. Accessors are available to set or get important wand attributes. A description of the MagickWand public methods are found here: Magick Wand Methods Set or Get Magick Wand Attributes Magick Wand Image Methods Pixel Iterator Methods Pixel Wand Methods Image Vector Drawing After you write your MagickWand program, compile it like this:
      cc `Wand-config --cflags --cppflags` wand.c `Wand-config --ldflags --libs`
Here is a example program that utilizes the MagickWand API to get you started, wand.c. It reads a GIF image, creates a thumbnail, and writes it to disk in the PNG image format.
      #include <stdio.h>
      #include <stdlib.h>
      #include <string.h>
      #include <time.h>
      #include <wand/magick-wand.h>

      int main(int argc,char **argv)
      {
      #define ThrowWandException(wand) \
      { \
        char \
          *description; \
       \
        ExceptionType \
          severity; \
       \
        description=MagickGetException(wand,&severity); \
        (void) fprintf(stderr,"%s %s %ld %s\n",GetMagickModule(),description); \
        description=(char *) MagickRelinquishMemory(description); \
        exit(-1); \
      }

        MagickBooleanType
          status;

        MagickWand
          *magick_wand;

        /*
          Read an image.
        */
        magick_wand=NewMagickWand();
        status=MagickReadImage(magick_wand,"image.gif");
        if (status == MagickFalse)
          ThrowWandException(magick_wand);
        /*
          Turn the images into a thumbnail sequence.
        */
        MagickResetIterator(magick_wand);
        while (MagickNextImage(magick_wand) != MagickFalse)
          MagickResizeImage(magick_wand,106,80,LanczosFilter,1.0);
        /*
          Write the image as MIFF and destroy it.
        */
        status=MagickWriteImages(magick_wand,"image.png",MagickTrue);
        if (status == MagickFalse)
          ThrowWandException(magick_wand);
        magick_wand=DestroyMagickWand(magick_wand);
        return(0);
      }

Discourse Server | Mailing Lists | Image Gallery | ImageMagick Studio
© 1999-2005 ImageMagick Studio LLC