>K Z 1 S 2 ImageMagick MagickInfo Structurep


.ImageMagick MagickInfo Structure

GThe MagickInfo structure is used by ImageMagick to register support forNan Image format. The MagickInfo structure is allocated with default parametersFby calling SetMagickInfo().YImage formats are registered by calling RegisterMagickInfo()Gwhich adds the initial structure to a linked list (at which point it isFowned by the list). A pointer to the structure describing a format mayRbe obtained by calling GetMagickInfo().PPass the argument NULL to obtain the first member of this list. A human-readableGlist of registered image formats may be printed to a file descriptor byEcalling ListMagickInfo().

Example:I

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

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

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

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

  info = SetMagickInfo("GIF");3

  if ( info == (MagickInfo*)NULL )1
    exit(1);0

  info->decoder = ReadGIFImage;2
  info->encoder = WriteGIFImage;/
  info->magick  = IsGIF;/
  info->adjoin  = False;F
  info->description = AllocateString("CompuServe graphicsinterchange format");:
  /* Add MagickInfo structure to list */-
  RegisterMagickInfo(info);/

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

  ListMagickInfo( stdout );
  return;
}L

The members of the MagickInfo structure are shown in the following table:
 56 8 bDH`IIPNMMHA=
MagickInfo Structure Members

Member


Type

#
Description

tagconst char *Magick string (e.g. "GIF") to call this format.
decoderImage *(*decoder)(const ImageInfo*)Function to decode image data and return ImageMagick Image.
encoderunsigned int (*encoder)(const ImageInfo*, Image *)Function to encode image data with options passed via ImageInfo=and image represented by Image.
magickunsigned int (*magick)(const unsigned char *,const unsigned int)Function to test file magick based on bytes starting at the specifiedTpointer with specified size. Returns non-zero (True) if file type is supported.
adjoinunsigned intSet to non-zero (True) if this file format supports multi-frame images.
blob_supportunsigned intSet to non-zero (True) if the encoder and decoder for this format supports=operating arbitrary BLOBs (rather than only disk files).
rawunsigned intImage format does not contain size (must be specified in ImageInfo).
descriptionconst char *Long form image format description (e.g. "CompuServe graphics interchangeformat").
datavoid *User specified data. A way to pass any sort of data structure to theXendoder/decoder. To set this, GetMagickInfo()Jmust be called to first obtain a pointer to the registered structure sincevit can not be set via a RegisterMagickInfo()parameter.
previousMagickInfoPrevious MagickInfo struct in linked-list. NULL if none.
nextMagickInfoNext MagickInfo struct in linked-list. NULL if none.





Home Page9Image manipulation software that works like magic.