ImageMagick: MagickCore, C API for ImageMagick: Get/Set Image Properties
Author: ImageMagick Studio LLC
Description: ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
Keywords: magickcore, c, api, for, imagemagick:, get/set, image, properties, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert

CloneImageProperties • DefineImageProperty • DeleteImageProperty • DestroyImageProperties • FormatImageProperty • GetImageProperty • GetNextImageProperty • InterpretImageProperties • (void) LogMagickEvent(TraceEvent,GetMagickModule • RemoveImageProperty • ResetImagePropertyIterator • SetImageProperty

## CloneImageProperties

CloneImageProperties() clones one or more image properties.

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 a key/value pair with an image property.

The format of the DefineImageProperty method is:

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

A description of each parameter follows:

image
  the image.
property
  the image property.

## 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() releases memory associated with image property values.

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.

The format of the GetImageProperty method is:

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

A description of each parameter follows:

image
  the image.
key
  the key.

## 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 properity, 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-expresions' ('*' 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 associacted set of properities.

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

The format of the InterpretImageProperties method is:

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

A description of each parameter follows:

image_info
  the image info.
image
  the image.
embed_text
  the address of a character string containing the embedded formatting characters.

## (void) LogMagickEvent(TraceEvent,GetMagickModule

(void) LogMagickEvent(TraceEvent,GetMagickModule(),"s",image->filename);

if (embed_text == (const char *) NULL) return((char *) NULL); p=embed_text;

if (*p == '\0') return(ConstantString(""));

/* handle a '@' replace string from file */ if (*p == '@') { p++; if (*p != '-' && (IsPathAccessible(p) == MagickFalse) ) { (void) ThrowMagickException(&image->exception,GetMagickModule(), OptionError,"UnableToAccessPath","s",p); return((char *) NULL); } return(FileToString(p,~0UL,&image->exception)); }

/* Translate any embedded format characters.

## 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:

    ResetImagePropertyIterator(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.

The format of the SetImageProperty method is:

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

A description of each parameter follows:

image
  the image.
property
  the image property.
values
  the image property values.