<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="description" content="ImageMagick, version 5.1.1, is a    robust collection of tools and libraries to read, write, and manipulate    an image in any of the more popular image formats including GIF, JPEG,    PNG, PDF, and Photo CD.  With ImageMagick you can create GIFs dynamically    making it suitable for Web applications.  You can also resize, rotate,    sharpen, color reduce, or add special effects to an image and save your    completed work in the same or  differing image format.">
   <meta name="keywords" content="ImageMagick, Image Magick, Image Magic,    PerlMagick, Perl Magick, Perl Magic, CineMagick, PixelMagick, Pixel Magic,    WebMagick, Web Magic, visualization, image processing, software     development, simulation, image, software, AniMagick, Animagic,    Magick++">
   <meta name="GENERATOR" content="Mozilla/4.7 [en] (X11; U; SunOS 5.6 sun4u) [Netscape]">
   <title>ImageMagick - Image Processing and Display Package</title>
<link rev="made" href="mailto:magick@wizards.dupont.com">
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#1F00FF" vlink="#9900DD" alink="#FF0000">

<center><img SRC="../images/magick_small.png" height=125 width=121></center>

<p><br>
<br>
<p><b>ImageMagick</b> has a number of functions that allow you to read,
manipulate, write, or display an image. These functions are accessible
through the various <a href="tools.html">tools</a> or the object-oriented
Perl interface, <a href="perl.html">PerlMagick</a>. 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 <tt>libMagick.a</tt>, <tt>libMagick.so</tt>, or <tt>Magick.dll</tt>
depending on your system.
<p>The API is divided into a number of categories:
<dl>
<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/image.html">ImageMagick
Image Methods</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/zoom.html">Methods
to Resize an Image</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/transform.html">Methods
to Transform an Image</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/draw.html">Methods
to Draw on an Image</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/annotate.html">Methods
to Annotate an Image</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/colors.html">Methods
to Count the Colors in an Image</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/decorate.html">ImageMagick
Image Decoration Methods</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/montage.html">ImageMagick
Methods to Create Image Thumbnails</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/effects.html">ImageMagick
Image Effects Methods</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/enhance.html">Methods
to Enhance an Image</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/quantize.html">Methods
to Reduce the Number of Unique Colors in an Image</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/segment.html">Methods
to Segment an Image with Thresholding Fuzzy c-Means</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/shear.html">Methods
to Shear or Rotate an Image by an Arbitrary Angle</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/signature.html">Methods
to Compute a Digital Signature for an Image</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/cache.html">ImageMagick
Pixel Cache Methods</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/blob.html">Methods
to Read or Write Binary Large OBjects</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/magick.html">Methods
to Read or List ImageMagick Image formats</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/error.html">ImageMagick
Error Methods</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/memory.html">ImageMagick
Memory Allocation Methods</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/monitor.html">ImageMagick
Progress Monitor Methods</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/display.html">Methods
to Interactively Display and Edit an Image</a></dd>

<dd>
<img SRC="../images/ball.png" ALT="*" height=14 width=14> <a href="api/animate.html">Methods
to Interactively Animate an Image Sequence</a></dd>
</dl>
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 <tt>image.c</tt> and <tt>effects.c</tt>.
<p>Here is a full example of a program, <tt>example.c</tt>, that reads
a JPEG image, creates a thumbnail, and writes it to disk in the PNG image
format.
<pre>&nbsp;&nbsp;&nbsp; #include &lt;stdio.h>
&nbsp;&nbsp;&nbsp; #include &lt;time.h>
&nbsp;&nbsp;&nbsp; #include &lt;sys/types.h>
&nbsp;&nbsp;&nbsp; #include &lt;magick/api.h>

&nbsp;&nbsp;&nbsp; #if defined(__cplusplus) || defined(c_plusplus)
&nbsp;&nbsp;&nbsp; #undef class
&nbsp;&nbsp;&nbsp; #endif

&nbsp;&nbsp;&nbsp; int main(int argc,char **argv)
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Image
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *image,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *scaled_image;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ImageInfo
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; image_info;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Initialize the image info structure and read an image.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GetImageInfo(&amp;image_info);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (void) strcpy(image_info.filename,"image.jpg");
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; image=ReadImage(&amp;image_info);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (image == (Image *) NULL)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit(1);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Turn the image into a thumbnail.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; scaled_image=ZoomImage(image,106,80);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (scaled_image != (Image *) NULL)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DestroyImage(image);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; image=scaled_image;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Write the image as PNG and destroy it.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (void) strcpy(image->filename,"image.png");
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WriteImage(&amp;image_info,image);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DestroyImage(image);
&nbsp;&nbsp;&nbsp; }</pre>
Now we need to compile. On Unix, the command would look something like
this:
<pre>&nbsp;&nbsp;&nbsp; cc `Magick-config --cflags --cppflags --ldflags --libs` example.c </pre>
Another example is <a href="smile.c">smile.c</a>. Compile and excute it
to display a smiley face on your X server.
<hr>
<p><a href="../ImageMagick.html"><img SRC="../images/home.png" ALT="Home Page" BORDER=0 height=40 width=40 align=CENTER></a><font size=-2>&nbsp;&nbsp;
Image manipulation software that works like magic.</font>
</body>
</html>
