ImageMagick – MagickCore, C API: Annotate an Image
Author: ImageMagick Studio LLC
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: Annotate an Image, Image Processing, Digital Image Editing, Image Conversion, Open-Source Software, Image Manipulation, Command-Line Image Tools

# Annotate

## AnnotateImage

AnnotateImage() annotates an image with text.

The format of the AnnotateImage method is:

    MagickBooleanType AnnotateImage(Image *image,DrawInfo *draw_info)

A description of each parameter follows:

image
  the image.
draw_info
  the draw info.

## FormatMagickCaption

FormatMagickCaption() formats a caption so that it fits within the image width. It returns the number of lines in the formatted caption.

The format of the FormatMagickCaption method is:

    ssize_t FormatMagickCaption(Image *image,DrawInfo *draw_info,
      const MagickBooleanType split,TypeMetric *metrics,char **caption)

A description of each parameter follows.

image

The image.

draw_info

the draw info.

split

when no convenient line breaks-- insert newline.

metrics

Return the font metrics in this structure.

caption

the caption.

## GetMultilineTypeMetrics

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

        character width
        character height
        ascender
        descender
        text width
        text height
        maximum horizontal advance
        bounds: x1
        bounds: y1
        bounds: x2
        bounds: y2
        origin: x
        origin: y
        underline position
        underline thickness

This method is like GetTypeMetrics() but it returns the maximum text width and height for multiple lines of text.

The format of the GetMultilineTypeMetrics method is:

    MagickBooleanType GetMultilineTypeMetrics(Image *image,
      const DrawInfo *draw_info,TypeMetric *metrics)

A description of each parameter follows:

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

## GetTypeMetrics

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

        character width
        character height
        ascender
        descender
        text width
        text height
        maximum horizontal advance
        bounds: x1
        bounds: y1
        bounds: x2
        bounds: y2
        origin: x
        origin: y
        underline position
        underline thickness

The format of the GetTypeMetrics method is:

    MagickBooleanType GetTypeMetrics(Image *image,const DrawInfo *draw_info,
      TypeMetric *metrics)

A description of each parameter follows:

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