ImageMagick – MagickCore, C API: Read or List Image formats
Description: ImageMagick is a free and open-source software suite used for editing and manipulating digital images. It provides a versatile set of tools for various image-related tasks. You can use ImageMagick to resize, convert, and apply various transformations to images. It supports a wide range of file formats, including JPEG, PNG, GIF, TIFF, and Ultra HDR.
Keywords: magickcore, c, api:, read, or, list, image, formats, image processing, image manipulation, image conversion, graphic design tool, image editing

# Magick

## AcquireMagickInfo

AcquireMagickInfo() allocates a MagickInfo structure and initializes the members to default values.

The format of the AcquireMagickInfo method is:

    MagickInfo *AcquireMagickInfo(const char *magick_module,
      const char *name,const char *description)

A description of each parameter follows:

magick_module
  a character string that represents the module associated with the MagickInfo structure.
name
  a character string that represents the image format associated with the MagickInfo structure.
description
  a character string that represents the image format associated with the MagickInfo structure.

## GetMagickPrecision

GetMagickPrecision() returns the maximum number of significant digits to be printed.

The format of the GetMagickPrecision method is:

    int GetMagickPrecision(void)

## IsMagickCoreInstantiated

IsMagickCoreInstantiated() returns MagickFalse if the ImageMagick environment has not been instantiated; the ImageMagick environment has been instantiated when MagickCoreGenesis() has been called but MagickDestroy() has not been called.

The format of the IsMagickCoreInstantiated method is:

    MagickBooleanType IsMagickCoreInstantiated(void)

## MagickCoreGenesis

MagickCoreGenesis() initializes the MagickCore environment.

The format of the MagickCoreGenesis function is:

    MagickCoreGenesis(const char *path,
      const MagickBooleanType establish_signal_handlers)

A description of each parameter follows:

path
  the execution path of the current ImageMagick client.
establish_signal_handlers
  set to MagickTrue to use MagickCore's own signal handlers for common signals.

## MagickCoreTerminus

MagickCoreTerminus() is a function in the ImageMagick library that is used to clean up and release resources when shutting down an application that uses ImageMagick. This function should be called in the primary thread of the application's process during the shutdown process. It's crucial that this function is invoked only after any threads that are using ImageMagick functions have terminated.

ImageMagick might internally use threads via OpenMP (a method for parallel programming). As a result, it's important to ensure that any function calls into ImageMagick have completed before calling MagickCoreTerminus(). This prevents issues with OpenMP worker threads accessing resources that are destroyed by this termination function.

If OpenMP is being used (starting from version 5.0), the OpenMP implementation itself handles starting and stopping worker threads and allocating and freeing resources using its own methods. This means that after calling MagickCoreTerminus(), some OpenMP resources and worker threads might still remain allocated. To address this, the function omp_pause_resource_all(omp_pause_hard) can be invoked. This function, introduced in OpenMP version 5.0, ensures that any resources allocated by OpenMP (such as threads and thread-specific memory) are freed. It's recommended to call this function after MagickCoreTerminus() has completed its execution.

The format of the MagickCoreTerminus function is:

    MagickCoreTerminus(void)

## SetMagickPrecision

SetMagickPrecision() sets the maximum number of significant digits to be printed.

An input argument of 0 returns the current precision setting.

A negative value forces the precision to reset to a default value according to the environment variable "MAGICK_PRECISION", the current 'policy' configuration setting, or the default value of '6', in that order.

The format of the SetMagickPrecision method is:

    int SetMagickPrecision(const int precision)

A description of each parameter follows:

precision
  set the maximum number of significant digits to be printed.