Sophie

Sophie

distrib > Mandriva > mes5 > x86_64 > by-pkgid > 0d81a008159b90d5a3553d84969a208b > files > 77

graphicsmagick-doc-1.2.5-2.3mdvmes5.2.x86_64.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1">
	<TITLE>C API: GraphicsMagick - Image Processing and Display Package</TITLE>
	<META NAME="GENERATOR" CONTENT="StarOffice 8  (Solaris x86)">
	<META NAME="CREATED" CONTENT="20030425;16380900">
	<META NAME="CHANGEDBY" CONTENT="Bob Friesenhahn">
	<META NAME="CHANGED" CONTENT="20080629;14515100">
	<META NAME="DESCRIPTION" CONTENT="GraphicsMagick 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 GraphicsMagick 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="GraphicsMagick, 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="CHANGEDBY" CONTENT="Bob Friesenhahn">
	<META NAME="CHANGEDBY" CONTENT="Bob Friesenhahn">
	<META NAME="CHANGEDBY" CONTENT="Bob Friesenhahn">
	<META NAME="CHANGEDBY" CONTENT="Bob Friesenhahn">
	<META NAME="CHANGEDBY" CONTENT="Bob Friesenhahn">
	<STYLE TYPE="text/css">
	<!--
		P { color: #000000; font-family: "Verdana", "Arial", "Helvetica", sans-serif; font-size: 12pt }
		DD { color: #000000; font-family: "Verdana", "Arial", "Helvetica", sans-serif; font-size: 12pt }
		PRE { color: #000000 }
		A:link { color: #0085c0 }
		A:visited { color: #800080 }
	-->
	</STYLE>
</HEAD>
<BODY LANG="en-US" TEXT="#000000" LINK="#0085c0" VLINK="#800080" BGCOLOR="#ffffff" DIR="LTR">
<P><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><I>GraphicsMagick</I></FONT>
<FONT FACE="Verdana, Arial, Helvetica, sans-serif">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="programming.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
</FONT><TT><FONT FACE="Verdana, Arial, Helvetica, sans-serif">libGraphicsMagick.a</FONT></TT><FONT FACE="Verdana, Arial, Helvetica, sans-serif">,
</FONT><TT><FONT FACE="Verdana, Arial, Helvetica, sans-serif">libGraphicsMagick.so</FONT></TT><FONT FACE="Verdana, Arial, Helvetica, sans-serif">,
or Graphics</FONT><TT><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Magick.dll</FONT></TT>
<FONT FACE="Verdana, Arial, Helvetica, sans-serif">depending on your
system. </FONT>
</P>
<P STYLE="margin-bottom: 0.1in"><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><FONT SIZE=3>The
API is divided into a number of categories: </FONT></FONT>
</P>
<UL>
	<LI><DD><A HREF="api/animate.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Animate:
	Interactively animate an image sequence</FONT></A></DD><LI><DD>
	<A HREF="api/annotate.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Annotate:
	Annotate an image with text</FONT></A></DD><LI><DD>
	<A HREF="api/attribute.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Attribute:
	Access key, value image attributes</FONT></A></DD><LI><DD>
	<A HREF="api/blob.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Blob:
	Read and write images to memory</FONT></A></DD><LI><DD>
	<A HREF="api/channel.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Channel:
	Import and export image channels as well as compute channel depth</FONT></A></DD><LI><DD>
	<A HREF="api/color.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Color:
	Methods to deal with image colors</FONT></A></DD><LI><DD>
	<A HREF="api/compare.html">Compare: Compare images</A></DD><LI><DD>
	<FONT FACE="Verdana, Arial, Helvetica, sans-serif"><A HREF="api/composite.html">Composite:
	Composite images</A> </FONT>
	</DD><LI><DD>
	<A HREF="api/constitute.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Constitute:
	Read, write, import, and export images</FONT></A></DD><LI><DD>
	<A HREF="api/decorate.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Decorate:
	Add fancy borders to images</FONT></A></DD><LI><DD>
	<A HREF="api/display.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Display:
	Interactively display and edit an image</FONT></A></DD><LI><DD>
	<A HREF="api/draw.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Draw:
	Convenient methods to draw vectors and text</FONT></A></DD><LI><DD>
	<A HREF="api/effect.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Effect:Threshold
	(various), blur, despeckle, edge, emboss, enhance, gaussian blur ...</FONT></A></DD><LI><DD>
	<A HREF="api/enhance.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Enhance:
	Contrast, equalize, gamma, level, level channel, modulate, negate,
	and normalize</FONT></A></DD><LI><DD>
	<A HREF="api/error.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Error:
	Error reporting methods</FONT></A></DD><LI><DD>
	<A HREF="api/fx.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">FX:
	Special effects methods</FONT></A></DD><LI><DD>
	<A HREF="api/image.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Image:
	Miscellaneous image methods</FONT></A></DD><LI><DD>
	<A HREF="api/list.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">List:
	Manage image lists</FONT></A></DD><LI><DD>
	<A HREF="api/magick.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Magick:
	Image format support interfaces</FONT></A></DD><LI><DD>
	<A HREF="api/memory.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Memory:
	Memory allocation methods</FONT></A></DD><LI><DD>
	<A HREF="api/monitor.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Monitor:
	Progress monitor callbacks</FONT></A></DD><LI><DD>
	<A HREF="api/montage.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Montage:
	Create a montage of image thumbnails</FONT></A></DD><LI><DD>
	<A HREF="api/operator.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Operator:
	Methods to apply mathematic or boolean operators to pixels</FONT></A></DD><LI><DD>
	<A HREF="api/paint.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Paint:
	Fill pixel regions</FONT></A></DD><LI><DD>
	<A HREF="api/quantize.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Quantize:
	Reduce image colors or assign image colors from colormap</FONT></A></DD><LI><DD>
	<A HREF="api/registry.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Registry:
	Store and retrieve images in memory by ID</FONT></A></DD><LI><DD>
	<A HREF="api/pixel_cache.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Pixel
	Cache: Low-level access to image pixels</FONT></A></DD><LI><DD>
	<FONT FACE="Verdana, Arial, Helvetica, sans-serif"><A HREF="api/resize.html">Resize:
	Resize an Image</A> </FONT>
	</DD><LI><DD>
	<A HREF="api/resource.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Resource:
	Set and get resource limits</FONT></A></DD><LI><DD>
	<A HREF="api/segment.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Segment:
	Coalese similar image colors</FONT></A></DD><LI><DD>
	<A HREF="api/shear.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Shear:
	Rotate image, shear image, or apply a 2D affine transformation</FONT></A></DD><LI><DD>
	<A HREF="api/signature.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Signature:
	Compute an image signature (checksum)</FONT></A></DD><LI><DD STYLE="margin-bottom: 0.2in">
	<A HREF="api/transform.html"><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Transform:
	Chop, coalesce, deconstruct, flatten, flip, flop, mosiac, roll, or
	shave image</FONT></A></DD></UL>
<P><FONT FACE="Verdana, Arial, Helvetica, sans-serif"><FONT SIZE=3>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.</FONT></FONT></P>
<P><FONT FACE="Verdana, Arial, Helvetica, sans-serif">Here is a full
example of a program, </FONT><TT><FONT FACE="Verdana, Arial, Helvetica, sans-serif">demo.c</FONT></TT><FONT FACE="Verdana, Arial, Helvetica, sans-serif">,
which reads multiple input files (possibly animation files) specified
on the command line, resizes the image frames to 106x80, and writes
the resulting animation to disk.</FONT></P>
<PRE>#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;time.h&gt;
#include &lt;sys/types.h&gt;
#include &lt;magick/api.h&gt;

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

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

  ImageInfo
    *image_info;

  int
    i;

  /*
    Initialize the image info structure and read the list of files
    provided by the user as a image sequence
  */
  InitializeMagick(*argv);
  GetExceptionInfo(&amp;exception);
  image_info=CloneImageInfo((ImageInfo *) NULL);
  images=NewImageList();
  for (i=1; i&lt; argc-1; i++)
    {
      (void) strcpy(image_info-&gt;filename,argv[i]);
      printf(&quot;Reading %s ...&quot;, image_info-&gt;filename);
      image=ReadImage(image_info,&amp;exception);
      printf(&quot; %lu frames\n&quot;, GetImageListLength(image));
      if (exception.severity != UndefinedException)
        CatchException(&amp;exception);
      if (image)
        (void) AppendImageToList(&amp;images,image);
    }

  if (!images)
    {
      printf(&quot;Failed to read any images!\n&quot;);
      exit(1);
    }
  /*
    Create a thumbnail image sequence
  */
  thumbnails=NewImageList();
  while ((image=RemoveFirstImageFromList(&amp;images)) != (Image *) NULL)
    {
      resize_image=ResizeImage(image,106,80,LanczosFilter,1.0,&amp;exception);
      DestroyImage(image);
      if (resize_image == (Image *) NULL)
        {
          CatchException(&amp;exception);
          continue;
        }
      (void) AppendImageToList(&amp;thumbnails,resize_image);
    }
  /*
    Write the thumbnail image sequence to file
  */
  if (thumbnails)
    {
      (void) strcpy(thumbnails-&gt;filename,argv[argc-1]);
      printf(&quot;Writing %s ... %lu frames\n&quot;, thumbnails-&gt;filename,
             GetImageListLength(thumbnails));
      WriteImage(image_info,thumbnails);
    }

  /*
    Release resources
  */
  DestroyImageList(thumbnails);
  DestroyImageInfo(image_info);
  DestroyExceptionInfo(&amp;exception);
  DestroyMagick();
  return(0);
}</PRE><P>
Now we need to compile. On Unix, the command would look something
like this: 
</P>
<PRE STYLE="margin-bottom: 0.2in">   gcc -o demo demo.c -O `GraphicsMagick-config --cppflags --ldflags --libs`</PRE><P>
As a usage example, with the input files in1.gif, in2.png, and
in3.jpg, create the animation file out.miff:</P>
<PRE STYLE="margin-bottom: 0.2in">   demo in1.gif in2.png in3.jpg out.miff</PRE><P>
The resulting animation may be played on an X11 display using '<FONT FACE="Cumberland">gm
animate out.miff</FONT>'.</P>
<P>The GraphicsMagick-config script reproduces the options which were
used to compile the GraphicsMagick utilities. Using compatible
options ensures that your program will compile and run.</P>
<P><FONT FACE="Albany">Another example is <A HREF="smile.c">smile.c</A>.
Compile and execute it to display a smiley face on your X server. </FONT>
</P>
<HR>
<P ALIGN=CENTER><FONT FACE="Albany"><A HREF="Copyright.html">Copyright</A>
</FONT><FONT FACE="Abadi Mt Condensed Extra Bold">&copy;</FONT>
<FONT FACE="Albany">GraphicsMagick Group 2002, 2003, 2004, 2008</FONT></P>
</BODY>
</HTML>