GraphicsMagick

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

# annotate

## Annotate an image with text

Contents

- AnnotateImage
- GetTypeMetrics

# AnnotateImage

## Synopsis

    unsigned int AnnotateImage( Image *image, DrawInfo *draw_info );

## Description

AnnotateImage() annotates an image with text. Optionally you can include any of the following bits of information about the image by embedding the appropriate special characters:

%b file size in bytes. %c comment. %d directory in which the image resides. %e extension of the image file. %f original filename of the image. %h height of image. %i filename of the image. %k number of unique colors. %l image label. %m image file format. %n number of images in a image sequence. %o output image filename. %p page number of the image. %q image depth (8 or 16). %p page number of the image. %q image depth (8 or 16). %s image scene number. %t image filename without any extension. %u a unique temporary filename. %w image width. %x x resolution of the image. %y y resolution of the image.

The format of the AnnotateImage method is:

    unsigned int AnnotateImage( Image *image, DrawInfo *draw_info );

A description of each parameter follows:

status:
  Method AnnotateImage returns True if the image is annotated otherwise False.
image:
  The image.
draw_info:
  The draw info.

# GetTypeMetrics

## Synopsis

    unsigned int GetTypeMetrics( Image *image, const DrawInfo *draw_info,
                                 TypeMetric *metrics );

## Description

GetTypeMetrics() returns the following information for the specified font and text:

o character width o character height o ascent o descent o text width o text height o maximum horizontal advance o underline position o underline thickness

The format of the GetTypeMetrics method is:

    unsigned int GetTypeMetrics( Image *image, const DrawInfo *draw_info,
                                 TypeMetric *metrics );

image:
  The image.
draw_info:
  The draw info.
metrics:
  Return the font metrics in this structure.