ImageMagick – MagickCore, C API: Get/Set Image Properties
Description: ImageMagick is a powerful, open-source software suite for creating, editing, converting, and manipulating images in over 200 formats. Ideal for web developers, graphic designers, and researchers, it offers versatile tools for image processing, including batch processing, format conversion, and complex image transformations.
Keywords: MagickCore, C API: Get/Set Image Properties, Image Processing, Digital Image Editing, Image Conversion, Open-Source Software, Image Manipulation, Command-Line Image Tools

# Property

## CloneImageProperties

CloneImageProperties() clones all the image properties to another image.

The format of the CloneImageProperties method is:

    MagickBooleanType CloneImageProperties(Image *image,
      const Image *clone_image)

A description of each parameter follows:

image
  the image.
clone_image
  the clone image.

## DefineImageProperty

DefineImageProperty() associates an assignment string of the form "key=value" with an artifact or options. It is equivalent to SetImageProperty().

The format of the DefineImageProperty method is:

    MagickBooleanType DefineImageProperty(Image *image,const char *property,
      ExceptionInfo *exception)

A description of each parameter follows:

image
  the image.
property
  the image property.
exception
  return any errors or warnings in this structure.

## DeleteImageProperty

DeleteImageProperty() deletes an image property.

The format of the DeleteImageProperty method is:

    MagickBooleanType DeleteImageProperty(Image *image,const char *property)

A description of each parameter follows:

image
  the image.
property
  the image property.

## DestroyImageProperties

DestroyImageProperties() destroys all properties and associated memory attached to the given image.

The format of the DestroyDefines method is:

    void DestroyImageProperties(Image *image)

A description of each parameter follows:

image
  the image.

## FormatImageProperty

FormatImageProperty() permits formatted property/value pairs to be saved as an image property.

The format of the FormatImageProperty method is:

    MagickBooleanType FormatImageProperty(Image *image,const char *property,
      const char *format,...)

A description of each parameter follows.

image

The image.

property

The attribute property.

format

A string describing the format to use to write the remaining arguments.

## GetImageProperty

GetImageProperty() gets a value associated with an image property.

This includes, profile prefixes, such as "exif:", "iptc:" and "8bim:" It does not handle non-profile prefixes, such as "fx:", "option:", or "artifact:".

The returned string is stored as a prosperity of the same name for faster lookup later. It should NOT be freed by the caller.

The format of the GetImageProperty method is:

    const char *GetImageProperty(const Image *image,const char *key,
      ExceptionInfo *exception)

A description of each parameter follows:

image
  the image.
key
  the key.
exception
  return any errors or warnings in this structure.

## GetNextImageProperty

GetNextImageProperty() gets the next free-form string property name.

The format of the GetNextImageProperty method is:

    char *GetNextImageProperty(const Image *image)

A description of each parameter follows:

image
  the image.

## InterpretImageProperties

InterpretImageProperties() replaces any embedded formatting characters with the appropriate image property and returns the interpreted text.

This searches for and replaces \n \r \ replaced by newline, return, and percent resp. &lt; &gt; &amp; replaced by '<', '>', '&' resp. replaced by percent

x [x] where 'x' is a single letter prosperity, case sensitive). [type:name] where 'type' a is special and known prefix. [name] where 'name' is a specifically known attribute, calculated value, or a per-image property string name, or a per-image 'artifact' (as generated from a global option). It may contain ':' as long as the prefix is not special.

Single letter substitutions will only happen if the character before the percent is NOT a number. But braced substitutions will always be performed. This prevents the typical usage of percent in a interpreted geometry argument from being substituted when the percent is a geometry flag.

If 'glob-expressions' ('*' or '?' characters) is used for 'name' it may be used as a search pattern to print multiple lines of "name=value\n" pairs of the associated set of properties.

The returned string must be freed using DestroyString() by the caller.

The format of the InterpretImageProperties method is:

    char *InterpretImageProperties(ImageInfo *image_info,
      Image *image,const char *embed_text,ExceptionInfo *exception)

A description of each parameter follows:

image_info
  the image info. (required)
image
  the image. (optional)
embed_text
  the address of a character string containing the embedded formatting characters.
exception
  return any errors or warnings in this structure.

## RemoveImageProperty

RemoveImageProperty() removes a property from the image and returns its value.

In this case the ConstantString() value returned should be freed by the caller when finished.

The format of the RemoveImageProperty method is:

    char *RemoveImageProperty(Image *image,const char *property)

A description of each parameter follows:

image
  the image.
property
  the image property.

## ResetImagePropertyIterator

ResetImagePropertyIterator() resets the image properties iterator. Use it in conjunction with GetNextImageProperty() to iterate over all the values associated with an image property.

The format of the ResetImagePropertyIterator method is:

    void ResetImagePropertyIterator(const Image *image)

A description of each parameter follows:

image
  the image.

## SetImageProperty

SetImageProperty() saves the given string value either to specific known attribute or to a freeform property string.

Attempting to set a property that is normally calculated will produce an exception.

The format of the SetImageProperty method is:

    MagickBooleanType SetImageProperty(Image *image,const char *property,
      const char *value,ExceptionInfo *exception)

A description of each parameter follows:

image
  the image.
property
  the image property.
values
  the image property values.
exception
  return any errors or warnings in this structure.