>K ø + Z D ImageMagick - Image Processing and Display Package9VL




G

ImageMagick has a number of functions that allow you to read,Fmanipulate, write, or display an image. These functions are accessibleIthrough the various tools or the object-orientedIPerl interface, PerlMagick. However, you can alsoNaccess the functions directly from your program through the Magick ApplicationIProgrammer Interface. To invoke the functions, write your program in yourFfavorite language while making calls to the Magick image functions andMlink with libMagick.a, libMagick.so, or Magick.dlldepending on your system.2

The API is divided into a number of categories:


c* ImageMagick'Methods to Constitute an Image

^* ImageMagickImage Methods

Y* Methodsto Resize an Image

^* Methodsto Transform an Image

Y* Methodsto Draw on an Image

]* Methodsto Annotate an Image

[* Methods(to Count the Colors in an Image

a* ImageMagick!Image Decoration Methods

`* ImageMagick+Methods to Create Image Thumbnails

`* ImageMagickImage Effects Methods

\* Methodsto Enhance an Image

]* Methods:to Reduce the Number of Unique Colors in an Image

\* Methods<to Segment an Image with Thresholding Fuzzy c-Means

Z* Methods:to Shear or Rotate an Image by an Arbitrary Angle

^* Methods4to Compute a Digital Signature for an Image

]* Image Text Attributes Methods

c* ImageMagickCache Views Methods

Y* Methods.to Read or Write Binary Large OBjects

[* Methods2to Read or List ImageMagick Image formats

^* ImageMagickError Methods

_* ImageMagick"Memory Allocation Methods

`* ImageMagick!Progress Monitor Methods

\* Methods3to Interactively Display and Edit an Image

\* Methods3to Interactively Animate an Image Sequence

[* Methods#to Get or Set Image Pixels

Y* ImagePixel FIFO

FHere is a sample program to get you started. To find out about all theOfunctions that are available, read the source code. Each function is delineatedIwith a full rows of percent signs with comments describing the parametersKrequired for the function and what it does. For ease in finding a function,Fthey are sorted in alphabetical order. Most of the image functions are1found in image.c and effects.c.F

Here is a full example of a program, example.c, that readsIa JPEG image, creates a thumbnail, and writes it to disk in the PNG imageformat.-

    #include <stdio.h>'    #include <time.h>,    #include <sys/types.h>-    #include <magick/api.h>B    #if defined(__cplusplus) || defined(c_plusplus)    #undef class    #endif1    int main(int argc,char **argv)    {,      ExceptionInfo5        exception;$      Image2        *image,7        *zoom_image;(      ImageInfo7        *image_info;!      /*a        Initialize the image info structure and read an image.!      */M      image_info=CloneImageInfo((ImageInfo *) NULL);O      (void) strcpy(image_info->filename,"image.jpg");J      image=ReadImage(image_info,&exception);;      if (image == (Image *) NULL)q        MagickError(exception.severity,exception.message,exception.qualifier);!      /*K        Turn the image into a thumbnail.!      */Q      zoom_image=ZoomImage(image,106,80,&exception);@      if (zoom_image == (Image *) NULL)q        MagickError(exception.severity,exception.message,exception.qualifier);3      DestroyImage(image);0      image=zoom_image;!      /*Q        Write the image as PNG and destroy it.!      */J      (void) strcpy(image->filename,"image.png");<      WriteImage(image_info,image);<      DestroyImageInfo(image_info);3      DestroyImage(image);    }
FNow we need to compile. On Unix, the command would look something likethis:`
    cc `Magick-config --cflags --cppflags --ldflags --libs` example.c 
GAnother example is smile.c. Compile and excute it*to display a smiley face on your X server.

Home Page  9Image manipulation software that works like magic.