<!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="GENERATOR" content="Mozilla/4.7 [en] (X11; U; SunOS 5.6 sun4u) [Netscape]">
   <meta name="Author" content="Bob Friesenhahn">
   <meta name="Description" content="Description of MagickInfo structure members.">
   <title>ImageMagick MagickInfo Structure</title>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#1F00FF" alink="#FF0000"
  vlink="#9900DD">

<center>
<h1>
ImageMagick MagickInfo Structure</h1></center>
The MagickInfo structure is used by ImageMagick to register support for
an Image format. The MagickInfo structure is allocated with default parameters
by calling <a href="../magick.html#SetMagickInfo">SetMagickInfo()</a>.
Image formats are registered by calling <a href="../magick.html">RegisterMagickInfo()</a>
which adds the initial structure to a linked list (at which point it is
owned by the list). A pointer to the structure describing a format may
be obtained by calling <a href="../magick.html#GetMagickInfo">GetMagickInfo()</a>.
Pass the argument NULL to obtain the first member of this list. A human-readable
list of registered image formats may be printed to a file descriptor by
calling <a href="../magick.html#ListMagickInfo">ListMagickInfo()</a>.
<p>Example:
<p><tt>export unsigned int IsGIF(const unsigned char *magick,unsigned int
length)</tt>
<br><tt>{</tt>
<br><tt>&nbsp; [ test image header for supported magick ... ]</tt>
<br><tt>}</tt>
<p><tt>export Image *ReadGIFImage(const ImageInfo *image_info)</tt>
<br><tt>{</tt>
<br><tt>&nbsp; [ decode the image ... ]</tt>
<br><tt>}</tt>
<p><tt>export unsigned int WriteGIFImage(const ImageInfo *image_info,Image
*image)</tt>
<br><tt>{</tt>
<br><tt>&nbsp; [ encode the image ... ]</tt>
<br><tt>}</tt>
<p><tt>#include &lt;stdio.h></tt>
<br><tt>int main( void )</tt>
<br><tt>{</tt>
<br><tt>&nbsp; struct MagickInfo* info;</tt><tt></tt>
<p><tt>&nbsp; info = SetMagickInfo("GIF");</tt><tt></tt>
<p><tt>&nbsp; if ( info == (MagickInfo*)NULL )</tt>
<br><tt>&nbsp;&nbsp;&nbsp; exit(1);</tt><tt></tt>
<p><tt>&nbsp; info->decoder = ReadGIFImage;</tt>
<br><tt>&nbsp; info->encoder = WriteGIFImage;</tt>
<br><tt>&nbsp; info->magick&nbsp; = IsGIF;</tt>
<br><tt>&nbsp; info->adjoin&nbsp; = False;</tt>
<br><tt>&nbsp; info->description = AllocateString("CompuServe graphics
interchange format");</tt>
<br><tt>&nbsp; /* Add MagickInfo structure to list */</tt>
<br><tt>&nbsp; RegisterMagickInfo(info);</tt>
<p><tt>&nbsp; info = GetMagickInfo("GIF");</tt>
<br><tt>&nbsp; [ do something with info ... ]</tt>
<p><tt>&nbsp; ListMagickInfo( stdout );</tt>
<br><tt>&nbsp; return;</tt>
<br><tt>}</tt>
<p>The members of the MagickInfo structure are shown in the following table:
<br>&nbsp;
<table BORDER WIDTH="100%" BGCOLOR="#CCCCCC" NOSAVE >
<caption><b>MagickInfo Structure Members</b></caption>

<tr>
<td>
<center><b>Member</b></center>
</td>

<td>
<center><b>Type</b></center>
</td>

<td>
<center><b>Description</b></center>
</td>
</tr>

<tr NOSAVE>
<td NOSAVE>tag</td>

<td NOSAVE>const char *</td>

<td>Magick string (e.g. "GIF") to call this format.</td>
</tr>

<tr NOSAVE>
<td>decoder</td>

<td NOSAVE><a href="Image.html">Image</a> *(*decoder)(const <a href="ImageInfo.html">ImageInfo</a>
*)</td>

<td>Function to decode image data and return ImageMagick Image.</td>
</tr>

<tr>
<td>encoder</td>

<td>unsigned int (*encoder)(const <a href="ImageInfo.html">ImageInfo</a>
*, Image *)</td>

<td>Function to encode image data with options passed via <a href="ImageInfo.html">ImageInfo</a>
and image represented by <a href="Image.html">Image</a>.</td>
</tr>

<tr>
<td>magick</td>

<td>unsigned int (*magick)(const unsigned char *,const unsigned int)</td>

<td>Function to test file magick based on bytes starting at the specified
pointer with specified size. Returns non-zero (True) if file type is supported.</td>
</tr>

<tr>
<td>adjoin</td>

<td>unsigned int</td>

<td>Set to non-zero (True) if this file format supports multi-frame images.</td>
</tr>

<tr>
<td>blob_support</td>

<td>unsigned int</td>

<td>Set to non-zero (True) if the encoder and decoder for this format supports
operating arbitrary BLOBs (rather than only disk files).</td>
</tr>

<tr>
<td>raw</td>

<td>unsigned int</td>

<td>Image format does not contain size (must be specified in ImageInfo).</td>
</tr>

<tr>
<td>description</td>

<td>const char *</td>

<td>Long form image format description (e.g. "CompuServe graphics interchange
format").</td>
</tr>

<tr>
<td>data</td>

<td>void *</td>

<td>User specified data. A way to pass any sort of data structure to the
endoder/decoder. To set this, <a href="../magick.html#GetMagickInfo">GetMagickInfo()</a>
must be called to first obtain a pointer to the registered structure since
it can not be set via a <a href="/home/bfriesen/src/graphics/ImageMagick/www/api/magick.html">RegisterMagickInfo()</a>
parameter.</td>
</tr>

<tr>
<td>previous</td>

<td>MagickInfo</td>

<td>Previous MagickInfo struct in linked-list. NULL if none.</td>
</tr>

<tr>
<td>next</td>

<td>MagickInfo</td>

<td>Next MagickInfo struct in linked-list. NULL if none.</td>
</tr>
</table>

<p>
<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>
Image manipulation software that works like magic.</font>
</body>
</html>
