ImageMagick has a number of functions that allow you to read, manipulate, write, or display an image. These functions are accessible through the various tools or the object-oriented Perl interface, PerlMagick. However, you can also access the functions directly from your program through the Magick Application Programmer Interface. To invoke the functions, write your program in your favorite language while making calls to the Magick image functions and link with `libMagick.a`, `libMagick.so`, or `Magick.dll` depending on your system.

The API is divided into a number of categories:

  ImageMagick Methods to Constitute an Image
  ImageMagick Image Methods
  Methods to Resize an Image
  Methods to Transform an Image
  Methods to Draw on an Image
  Methods to Annotate an Image
  Methods to Count the Colors in an Image
  ImageMagick Image Decoration Methods
  ImageMagick Methods to Create Image Thumbnails
  ImageMagick Image Effects Methods
  Methods to Enhance an Image
  Methods to Reduce the Number of Unique Colors in an Image
  Methods to Segment an Image with Thresholding Fuzzy c-Means
  Methods to Shear or Rotate an Image by an Arbitrary Angle
  Methods to Compute a Digital Signature for an Image
  Image Text Attributes Methods
  Methods to Get or Set Image Pixels
  ImageMagick Cache Views Methods
  Methods to Read or Write Binary Large OBjects
  Methods to Read or List ImageMagick Image formats
  ImageMagick Error Methods
  ImageMagick Memory Allocation Methods
  ImageMagick Progress Monitor Methods
  Methods to Interactively Display and Edit an Image
  Methods to Interactively Animate an Image Sequence
  Image Pixel FIFO

Here is a sample program to get you started. To find out about all the functions that are available, read the source code. Each function is delineated with a full rows of percent signs with comments describing the parameters required for the function and what it does. For ease in finding a function, they are sorted in alphabetical order. Most of the image functions are found in `image.c` and `effects.c`.

Here is a full example of a program, `example.c`, that reads a JPEG image, creates a thumbnail, and writes it to disk in the PNG image format.

        #include <stdio.h>
        #include <time.h>
        #include <sys/types.h>
        #include <magick/api.h>

        int main(int argc,char **argv)
        {
          ExceptionInfo
            exception;

          Image
            *image,
            *zoom_image;

          ImageInfo
            *image_info;

          /*
            Initialize the image info structure and read an image.
          */
          MagickIncarnate(*argv);
          GetExceptionInfo(&exception);
          image_info=CloneImageInfo((ImageInfo *) NULL);
          (void) strcpy(image_info->filename,"image.jpg");
          image=ReadImage(image_info,&exception);
          if (image == (Image *) NULL)
            MagickError(exception.severity,exception.message,exception.qualifier);
          /*
            Turn the image into a thumbnail.
          */
          zoom_image=ZoomImage(image,106,80,&exception);
          if (zoom_image == (Image *) NULL)
            MagickError(exception.severity,exception.message,exception.qualifier);
          DestroyImage(image);
          image=zoom_image;
          /*
            Write the image as PNG and destroy it.
          */
          (void) strcpy(image->filename,"image.png");
          WriteImage(image_info,image);
          DestroyImageInfo(image_info);
          DestroyImage(image);
          return(0);
        }

Now we need to compile. On Unix, the command would look something like this:

        gcc `Magick-config --cflags --cppflags --ldflags --libs` example.c

Another example is smile.c. Compile and excute it to display a smiley face on your X server.

Image manipulation software that works like magic.