GraphicsMagick

- Home
- Project
- Download
- Install
- Source
- News
- Utilities
- Programming
- Reference

# attribute

## Access key,value image attributes

Contents

- CloneImageAttributes
- DestroyImageAttributes
- GetImageAttribute
- GetImageClippingPathAttribute
- SetImageAttribute

# CloneImageAttributes

## Synopsis

    MagickPassFail CloneImageAttributes( Image *clone_image,
                                         const Image *original_image );

## Description

CloneImageAttributes() copies the text attibutes from one image to another. Any text attributes in the destination image are preserved. CloneImageAttributes returns MagickPass if all of the attribututes are successfully cloned or MagickFail if there is a memory allocation error.

The format of the CloneImageAttributes method is:

    MagickPassFail CloneImageAttributes( Image *clone_image,
                                         const Image *original_image );

clone_image:
  The destination image.
original_image:
  The source image.

# DestroyImageAttributes

## Synopsis

    DestroyImageAttributes( Image *image );

## Description

DestroyImageAttributes() deallocates memory associated with the image attribute list.

The format of the DestroyImageAttributes method is:

    DestroyImageAttributes( Image *image );

A description of each parameter follows:

image:
  The image.

# GetImageAttribute

## Synopsis

    const ImageAttribute *GetImageAttribute( const Image *image, const char *key );

## Description

GetImageAttribute() searches the list of image attributes and returns a pointer to the attribute if it exists otherwise NULL.

The format of the GetImageAttribute method is:

    const ImageAttribute *GetImageAttribute( const Image *image, const char *key );

image:
  The image.
key:
  These character strings are the name of an image attribute to return.

# GetImageClippingPathAttribute

## Synopsis

    const ImageAttribute *GetImageClippingPathAttribute( const Image *image );

## Description

Method GetImageClippingPathAttribute searches the list of image attributes and returns a pointer to a clipping path if it exists otherwise NULL.

The format of the GetImageClippingPathAttribute method is:

    const ImageAttribute *GetImageClippingPathAttribute( const Image *image );

A description of each parameter follows:

attribute:
  Method GetImageClippingPathAttribute returns the clipping path if it exists otherwise NULL.
image:
  The image.

# SetImageAttribute

## Synopsis

    unsigned int SetImageAttribute( Image *image, const char *key, const char *value );

## Description

SetImageAttribute() searches the list of image attributes and replaces the attribute value. If it is not found in the list, the attribute name and value is added to the list. If the attribute exists in the list, the value is concatenated to the attribute. SetImageAttribute returns True if the attribute is successfully concatenated or added to the list, otherwise False. If the value is NULL, the matching key is deleted from the list.

There is special handling for the EXIF:Orientation attribute. Setting this attribute will also update the EXIF tag in the image's EXIF profile to the given value provided an EXIF profile exists and has an existing EXIF orientation tag and the attribute value is a valid orientation (see orientationType). The attribute value will be set regardless of whether the EXIF profile was successfully updated. The new EXIF:Orientation attribute replaces the existing value rather than being concatenated to it as when setting other attributes. The 'comment' and 'label' attributes are treated specially in that embedded format specifications are translated according to the formatting rules of TranslateText().

The format of the SetImageAttribute method is:

    unsigned int SetImageAttribute( Image *image, const char *key, const char *value );

image:
  The image.
key,value:
  These character strings are the name and value of an image attribute to replace or add to the list.