# ImageMagick: MagickWand, C API for ImageMagick
ImageMagick® is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (about 100) including GIF, JPEG, JPEG-2000, PNG, PDF, PhotoCD, TIFF, and DPX. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves. ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you can freely use, copy, modify, and distribute. Its license is compatible with the [cut: 1167 characters, first 599 kept]
Author: ImageMagick Studio LLC
Keywords: magickwc, api, for, imagemagick, ImageMagick, ImageMagic, MagickCore, MagickWand, PerlMagick, Magick++, RMagick, PythonMagick, JMagick, TclMagick, Image, Magick, Magic, Wand

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 properties. A description of the MagickWand public methods are found here:

- Magick Wand Methods
- Set or Get Magick Wand Properties
- 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 <wand/MagickWand.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.
        */
        MagickWandGenesis();
        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);
        MagickWandTerminus();
        return(0);
      }

Discourse Server • Mailing Lists • ImageMagick Studio