ImageMagick: MagickCore, Low-level 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: magickcore, low-level, c, api, for, imagemagick, ImageMagick, PerlMagick, Magick++, Image, Magick

The MagickCore API is a low-level interface between the C programming language and the ImageMagick image processing libraries and is recommended for wizard-level programmers only. Unlike the MagickWand C API which uses only a few opaque types and accessors, with MagickCore you almost exlusively access the structure members directly. A description of the MagickCore public methods are found here: Initialize or Destroy the ImageMagick Environment Constitute an Image Composite an Image Image Methods Count the Colors in an Image Dealing with Image Colorspaces Dealing with Image Profiles Reduce the Number of Unique Colors in an Image Segment an Image with Thresholding Fuzzy c-Means Resize an Image Transform an Image Shear or Rotate an Image by an Arbitrary Angle Enhance an Image Add an Effect Add a Special Effect Decorate an Image Set Text Attributes Annotate an Image Paint on an Image Draw on an Image Create an Image Thumbnail Compare an Image to a Reconstructed Image Interactively Display and Edit an Image Interactively Animate an Image Sequence Get or Set Image Pixels Working with Image Lists Working with Cache Views The Pixel FIFO Read or Write Binary Large OBjects Compute a Message Digest for an Image The Registry Dealing with Exceptions Memory Allocation Monitor or Limit Resource Consumption Monitor the Progress of an Image Operation Get the Version and Copyrights After you write your MagickCore program, compile it like this:
      cc `Magick-config --cflags --cppflags` core.c `Magick-config --ldflags --libs`
Here is a example program that utilizes the MagickCore API to get you started, core.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 <magick/MagickCore.h>

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

        Image
          *image,
          *images,
          *resize_image,
          *thumbnails;

        ImageInfo
          *image_info;

        /*
          Initialize the image info structure and read an image.
        */
        InitializeMagick(*argv);
        exception=AcquireExceptionInfo();
        image_info=CloneImageInfo((ImageInfo *) NULL);
        (void) strcpy(image_info->filename,"image.gif");
        images=ReadImage(image_info,exception);
        if (exception->severity != UndefinedException)
          CatchException(exception);
        if (images == (Image *) NULL)
          exit(1);
        /*
          Turn the images into a thumbnail sequence.
        */
        thumbnails=NewImageList();
        while ((image=RemoveFirstImageFromList(&images)) != (Image *) NULL)
        {
          resize_image=ResizeImage(image,106,80,LanczosFilter,1.0,exception);
          if (resize_image == (Image *) NULL)
            MagickError(exception->severity,exception->reason,exception->description);
          (void) AppendImageToList(&thumbnails,resize_image);
          DestroyImage(image);
        }
        /*
          Write the image as MIFF and destroy it.
        */
        (void) strcpy(thumbnails->filename,"image.png");
        WriteImage(image_info,thumbnails);
        thumbnails=DestroyImageList(thumbnails);
        image_info=DestroyImageInfo(image_info);
        exception=DestroyExceptionInfo(exception);
        DestroyMagick();
        return(0);
      }

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