magick

Image format support interfaces

Contents

DestroyMagick

Synopsis

DestroyMagick( void );

Description

DestroyMagick() destroys the GraphicsMagick environment, releasing all allocated semaphores, memory, and temporary files. This function should be invoked in the primary (original) thread of the application's process while shutting down, and only after any threads which might be using GraphicsMagick functions have terminated. Since GraphicsMagick may use threads internally via OpenMP, it is also necessary for any function calls into GraphicsMagick to have already returned so that OpenMP worker threads are quiesced and won't be accessing any semaphores or data structures which are destroyed by this function.

The OpenMP implementation (if present) starts/stops any OpenMP worker threads and allocates/frees OpenMP resources using its own algorithms. This means that OpenMP worker threads and OpenMP resources are likely to remain allocated after DestroyMagick() returns. Since OpenMP 5.0, invoking omp_pause_resource_all(omp_pause_hard) will assure that any resources allocated by OpenMP (threads, thread-specific memory, etc.) are freed, and this may be called after DestroyMagick() has returned.

The format of the DestroyMagick function is:

DestroyMagick( void );

DestroyMagickInfo

Synopsis

void DestroyMagickInfo( MagickInfo ** magick_info );

Description

DestroyMagickInfo() destroys a MagickInfo structure.

The format of the DestroyMagickInfoList method is:

void DestroyMagickInfo( MagickInfo ** magick_info );

DestroyMagickInfoList

Synopsis

void DestroyMagickInfoList( void );

Description

DestroyMagickInfo() deallocates memory associated with the MagickInfo list.

The format of the DestroyMagickInfoList method is:

void DestroyMagickInfoList( void );

GetImageMagick

Synopsis

const char *GetImageMagick( const unsigned char *magick, const size_t length );

Description

GetImageMagick() searches for an image format that matches the specified magick string. If one is found the name is returned otherwise NULL.

The format of the GetImageMagick method is:

const char *GetImageMagick( const unsigned char *magick, const size_t length );
magick:

The image format we are searching for.

length:

The length of the binary string.

GetMagickInfo

Synopsis

const MagickInfo *GetMagickInfo( const char *name, ExceptionInfo *exception );

Description

GetMagickInfo() returns a pointer MagickInfo structure that matches the specified name. If name is NULL, the head of the image format list is returned. It is not safe to traverse the list by using the previous and next pointers in the MagickInfo structure since the list contents or order may be altered while the list is being traversed. If the list must be traversed, access it via the GetMagickInfoArray function instead.

If GraphicsMagick has not been initialized via InitializeMagick() then this function will not work.

The format of the GetMagickInfo method is:

const MagickInfo *GetMagickInfo( const char *name, ExceptionInfo *exception );

A description of each parameter follows:

name:

The image format we are looking for.

exception:

Return any errors or warnings in this structure.

GetMagickInfoArray

Synopsis

MagickInfo ** GetMagickInfoArray( ExceptionInfo *exception );

Description

GetMagickInfoArray() returns a sorted null-terminated array of MagickInfo pointers corresponding to the available format registrations. If necessarly all modules are loaded in order to return a complete list. This function should be used to access the entire list rather than GetMagickInfo since the list returned by GetMagickInfo may be re-ordered every time it is invoked. Once the returned array is no longer needed, the allocated array should be deallocated. Do not attempt to deallocate the MagickInfo structures based on pointers in the array!

The format of the GetMagickList method is:

MagickInfo ** GetMagickInfoArray( ExceptionInfo *exception );

A description of each parameter follows:

exception:

Return any errors or warnings in this structure.

InitializeMagick

Synopsis

InitializeMagick( const char *path );

Description

InitializeMagick() initializes the GraphicsMagick environment.

InitializeMagick() or InitializeMagickEx() MUST be invoked by the using program before making use of GraphicsMagick functions or else the library will be unusable and any usage is likely to cause a crash.

This function should be invoked in the primary (original) thread of the application's process, and before starting any OpenMP threads, as part of program initialization.

If alternate memory allocations are provided via MagickAllocFunctions() then that function should be invoked before InitializeMagickEx() since the memory allocation functions need to be consistent.

The format of the InitializeMagick function is:

InitializeMagick( const char *path );

A description of each parameter follows:

path:

The execution path of the current GraphicsMagick client (or NULL)

InitializeMagickEx

Synopsis

MagickPassFail InitializeMagickEx( const char *path, unsigned int options,
                                   ExceptionInfo *exception );

Description

InitializeMagickEx() initializes the GraphicsMagick environment, providing a bit more more control and visibility over initialization than the original InitializeMagick(). Use DestroyMagick() to destroy the GraphicsMagick environment when it is not longer needed.

InitializeMagick() or InitializeMagickEx() MUST be invoked by the using program before making use of GraphicsMagick functions or else the library will be unusable and any usage is likely to cause a crash.

This function should be invoked in the primary (original) thread of the application's process, and before starting any OpenMP threads, as part of program initialization.

If alternate memory allocations are provided via MagickAllocFunctions() then that function should be invoked before InitializeMagickEx() since the memory allocation functions need to be consistent.

Available options are:

o MAGICK_OPT_NO_SIGNAL_HANDER - Don't register ANSI/POSIX signal handlers

The format of the InitializeMagickEx function is:

MagickPassFail InitializeMagickEx( const char *path, unsigned int options,
                                   ExceptionInfo *exception );
path:

The execution path of the current GraphicsMagick client (or NULL)

options:

Options bit flags tailoring initializations performed

exception:

Information about initialization failure is reported here.

IsMagickConflict

Synopsis

MagickBool IsMagickConflict( const char *magick );

Description

Method IsMagickConflict returns true if the image format conflicts with a logical drive (.e.g. X:).

The format of the IsMagickConflict method is:

MagickBool IsMagickConflict( const char *magick );

A description of each parameter follows:

status:

Method IsMagickConflict returns true if the image format conflicts with a logical drive.

magick:

Specifies the image format.

ListMagickInfo

Synopsis

MagickPassFail ListMagickInfo( FILE *file, ExceptionInfo *exception );

Description

ListMagickInfo() lists the image formats to a file.

The format of the ListMagickInfo method is:

MagickPassFail ListMagickInfo( FILE *file, ExceptionInfo *exception );

A description of each parameter follows.

file:

A file handle.

exception:

Return any errors or warnings in this structure.

ListModuleMap

Synopsis

MagickPassFail ListModuleMap( FILE *file, ExceptionInfo *exception );

Description

Method ListModuleMap lists the module alias info to a file in the XML format used by modules.mgk. True is returned on success.

The format of the ListModuleMap method is:

MagickPassFail ListModuleMap( FILE *file, ExceptionInfo *exception );

A description of each parameter follows.

file:

An pointer to a FILE.

exception:

Return any errors or warnings in this structure.

MagickToMime

Synopsis

char *MagickToMime( const char *magick );

Description

Method MagickToMime returns the officially registered (or de facto) MIME media-type corresponding to a magick string. If there is no registered media-type, then the string "image/x-magick" (all lower case) is returned. The returned string must be deallocated by the user.

The format of the MagickToMime method is:

char *MagickToMime( const char *magick );

A description of each parameter follows.

magick:

GraphicsMagick format specification "magick" tag.

RegisterMagickInfo

Synopsis

MagickInfo *RegisterMagickInfo( MagickInfo *magick_info );

Description

RegisterMagickInfo() adds attributes for a particular image format to the list of supported formats. The attributes include the image format name, a method to read and/or write the format, whether the format supports the saving of more than one frame to the same file or blob, whether the format supports native in-memory I/O, and a brief description of the format.

The format of the RegisterMagickInfo method is:

MagickInfo *RegisterMagickInfo( MagickInfo *magick_info );

A description of each parameter follows:

magick_info:

The magick info.

PanicDestroyMagick

Synopsis

void PanicDestroyMagick( void );

Description

PanicDestroyMagick() destroys only persistent allocations such as temporary files. Other allocations (e.g. semaphores and heap memory) remain allocated. This function is an alternative to DestroyMagick() which is async-safe so it may be invoked from signal handers, and may be invoked from thread context. No semaphores are taken and no additional heap memory is allocated by this function. The program must quit immediately after invoking this function.

The format of the PanicDestroyMagick function is:

void PanicDestroyMagick( void );

SetMagickInfo

Synopsis

MagickInfo *SetMagickInfo( const char *name );

Description

Method SetMagickInfo allocates a MagickInfo structure and initializes the members to default values.

The format of the SetMagickInfo method is:

MagickInfo *SetMagickInfo( const char *name );

A description of each parameter follows:

magick_info:

Method SetMagickInfo returns the allocated and initialized MagickInfo structure.

name:

a character string that represents the image format associated with the MagickInfo structure.

UnregisterMagickInfo

Synopsis

unsigned int UnregisterMagickInfo( const char *name );

Description

Method UnregisterMagickInfo removes a name from the magick info list. It returns MagickFail if the name does not exist in the list otherwise MagickPass.

The format of the UnregisterMagickInfo method is:

unsigned int UnregisterMagickInfo( const char *name );

A description of each parameter follows:

status:

Method UnregisterMagickInfo returns False if the name does not exist in the list otherwise True.

name:

a character string that represents the image format we are looking for.


Copyright © GraphicsMagick Group 2002 - 2024