# ImageMagick MagickInfo Structure

The MagickInfo structure is used by ImageMagick to register support for an Image format. Image formats are registered by calling RegisterMagickInfo() which adds the initial structure to a linked list. A pointer to the structure describing a format may be obtained by calling GetMagickInfo(). Currently no function exists to obtain the first member of this list. As a work-around GetMagickInfo() may be called for format "AVS" (the first format in the list) to return the head of the list. A human-readable list of registered image formats may be printed to file descriptor by calling ListMagickInfo().

Example:

`export unsigned int IsGIF(const unsigned char *magick,unsigned int length)`
`{`
`[ test image header for supported magick ... ]`
`}`

`export Image *ReadGIFImage(const ImageInfo *image_info)`
`{`
`[ decode the image ... ]`
`}`

`export unsigned int WriteGIFImage(const ImageInfo *image_info,Image *image)`
`{`
`[ encode the image ... ]`
`}`

`#include <stdio.h>`
`int main( void )`
`{`
`struct MagickInfo info;`

`(void) RegisterMagickInfo("GIF",ReadGIFImage,WriteGIFImage,IsGIF,True,`
`True,"CompuServe graphics interchange format");`

`info = GetMagickInfo("GIF");`
`[ do something with info ... ]`

`ListMagickInfo( stdout );`
`return;`
`}`

The members of the MagickInfo structure are shown in the following table:

MagickInfo Structure Members
Member | Type | Description
tag | const char * | Magick string (e.g. "GIF") to call this format.
decoder | Image *(*decoder)(const ImageInfo *) | Function to decode image data and return ImageMagick Image.
encoder | unsigned int (*encoder)(const ImageInfo *, Image *) | Function to encode image data with options passed via ImageInfo and image represented by Image.
magick | unsigned int (*magick)(const unsigned char *,const unsigned int) | 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.
adjoin | unsigned int | Set to non-zero (True) if this file format supports multi-frame images.
blob_support | unsigned int | Set to non-zero (True) if the encoder and decoder for this format supports operating arbitrary BLOBs (rather than only disk files).
description | const char * | Long form image format description (e.g. "CompuServe graphics interchange format").
data | void * | User specified data. A way to pass any sort of data structure to the endoder/decoder. To set this, GetMagickInfo() must be called to first obtain a pointer to the registered structure since it can not be set via a RegisterMagickInfo() parameter.
previous | MagickInfo | Previous MagickInfo struct in linked-list. NULL if none.
next | MagickInfo | Next MagickInfo struct in linked-list. NULL if none.