1
2
3
4
5<!DOCTYPE html>
6<html lang="en">
7<head>
8  <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
9    <title>ImageMagick: MagickCore, C API for ImageMagick: Annotate an Image</title>
10  <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
11  <meta name="application-name" content="ImageMagick"/>
12  <meta name="description" content="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."/>
13  <meta name="application-url" content="http://www.imagemagick.org"/>
14  <meta name="generator" content="PHP"/>
15  <meta name="keywords" content="magickcore, c, api, for, imagemagick:, annotate, an, image, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert"/>
16  <meta name="rating" content="GENERAL"/>
17  <meta name="robots" content="INDEX, FOLLOW"/>
18  <meta name="generator" content="ImageMagick Studio LLC"/>
19  <meta name="author" content="ImageMagick Studio LLC"/>
20  <meta name="revisit-after" content="2 DAYS"/>
21  <meta name="resource-type" content="document"/>
22  <meta name="copyright" content="Copyright (c) 1999-2016 ImageMagick Studio LLC"/>
23  <meta name="distribution" content="Global"/>
24  <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/>
25  <link rel="icon" href="../image/wand.png"/>
26  <link rel="shortcut icon" href="../image/wand.ico"/>
27  <link rel="stylesheet" href="../css/magick.php"/>
28</head>
29<body>
30<div class="main">
31<div class="magick-masthead">
32  <div class="container">
33    <script async="async" src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle"
34         style="display:block"
35         data-ad-client="ca-pub-3129977114552745"
36         data-ad-slot="6345125851"
37         data-ad-format="auto"></ins>
38    <script>
39      (adsbygoogle = window.adsbygoogle || []).push({});
40    </script>
41    <nav class="magick-nav">
42      <a class="magick-nav-item " href="../index.php">Home</a>
43      <a class="magick-nav-item " href="../script/binary-releases.php">Download</a>
44      <a class="magick-nav-item " href="../script/command-line-tools.php">Tools</a>
45      <a class="magick-nav-item " href="../script/command-line-options.php">Options</a>
46      <a class="magick-nav-item " href="../script/resources.php">Resources</a>
47      <a class="magick-nav-item " href="../script/api.php">Develop</a>
48      <a class="magick-nav-item " href="../script/search.php">Search</a>
49      <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
50    </nav>
51  </div>
52</div>
53<div class="container">
54<div class="magick-header">
55<p class="text-center"><a href="annotate.php#AnnotateImage">AnnotateImage</a> &bull; <a href="annotate.php#FormatMagickCaption">FormatMagickCaption</a> &bull; <a href="annotate.php#GetMultilineTypeMetrics">GetMultilineTypeMetrics</a> &bull; <a href="annotate.php#GetTypeMetrics">GetTypeMetrics</a></p>
56
57<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/annotate_8c.html" id="AnnotateImage">AnnotateImage</a></h2>
58
59<p>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:</p>
60
61<pre class="text">
62    \n   newline
63    \r   carriage return
64    &lt;    less-than character.
65    &gt;    greater-than character.
66    &amp;    ampersand character.
67 a percent sign
68    b   file size of image read in
69    c   comment meta-data property
70    d   directory component of path
71    e   filename extension or suffix
72    f   filename (including suffix)
73    g   layer canvas page geometry   (equivalent to "WxHXY")
74    h   current image height in pixels
75    i   image filename (note: becomes output filename for "info:")
76    k   CALCULATED: number of unique colors
77    l   label meta-data property
78    m   image file format (file magic)
79    n   number of images in current image sequence
80    o   output filename  (used for delegates)
81    p   index of image in current image list
82    q   quantum depth (compile-time constant)
83    r   image class and colorspace
84    s   scene number (from input unless re-assigned)
85    t   filename without directory or extension (suffix)
86    u   unique temporary filename (used for delegates)
87    w   current width in pixels
88    x   x resolution (density)
89    y   y resolution (density)
90    z   image depth (as read in unless modified, image save depth)
91    A   image transparency channel enabled (true/false)
92    C   image compression type
93    D   image GIF dispose method
94    G   original image size (wxh; before any resizes)
95    H   page (canvas) height
96    M   Magick filename (original file exactly as given,  including read mods)
97    O   page (canvas) offset ( = XY )
98    P   page (canvas) size ( = WxH )
99    Q   image compression quality ( 0 = default )
100    S   ?? scenes ??
101    T   image time delay (in centi-seconds)
102    U   image resolution units
103    W   page (canvas) width
104    X   page (canvas) x offset (including sign)
105    Y   page (canvas) y offset (including sign)
106    Z   unique filename (used for delegates)
107    @   CALCULATED: trim bounding box (without actually trimming)
108    #   CALCULATED: 'signature' hash of image values
109</pre>
110
111<p>The format of the AnnotateImage method is:</p>
112
113<pre class="text">
114MagickBooleanType AnnotateImage(Image *image,DrawInfo *draw_info,
115  ExceptionInfo *exception)
116</pre>
117
118<p>A description of each parameter follows:</p>
119
120<dd>
121</dd>
122
123<dd> </dd>
124<dl class="dl-horizontal">
125<dt>image</dt>
126<dd>the image. </dd>
127
128<dd> </dd>
129<dt>draw_info</dt>
130<dd>the draw info. </dd>
131
132<dd> </dd>
133<dt>exception</dt>
134<dd>return any errors or warnings in this structure. </dd>
135
136<dd>  </dd>
137</dl>
138<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/annotate_8c.html" id="FormatMagickCaption">FormatMagickCaption</a></h2>
139
140<p>FormatMagickCaption() formats a caption so that it fits within the image width.  It returns the number of lines in the formatted caption.</p>
141
142<p>The format of the FormatMagickCaption method is:</p>
143
144<pre class="text">
145ssize_t FormatMagickCaption(Image *image,DrawInfo *draw_info,
146  const MagickBooleanType split,TypeMetric *metrics,char **caption,
147  ExceptionInfo *exception)
148</pre>
149
150<p>A description of each parameter follows.</p>
151
152<dt>image</dt>
153<p>The image.</p>
154
155<dt>draw_info</dt>
156<p>the draw info.</p>
157
158<dt>split</dt>
159<p>when no convenient line breaks-- insert newline.</p>
160
161<dt>metrics</dt>
162<p>Return the font metrics in this structure.</p>
163
164<dt>caption</dt>
165<p>the caption.</p>
166
167<dt>exception</dt>
168<p>return any errors or warnings in this structure.</p>
169
170<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/annotate_8c.html" id="GetMultilineTypeMetrics">GetMultilineTypeMetrics</a></h2>
171
172<p>GetMultilineTypeMetrics() returns the following information for the specified font and text:</p>
173
174<pre class="text">
175    character width
176    character height
177    ascender
178    descender
179    text width
180    text height
181    maximum horizontal advance
182    bounds: x1
183    bounds: y1
184    bounds: x2
185    bounds: y2
186    origin: x
187    origin: y
188    underline position
189    underline thickness
190</pre>
191
192<p>This method is like GetTypeMetrics() but it returns the maximum text width and height for multiple lines of text.</p>
193
194<p>The format of the GetMultilineTypeMetrics method is:</p>
195
196<pre class="text">
197MagickBooleanType GetMultilineTypeMetrics(Image *image,
198  const DrawInfo *draw_info,TypeMetric *metrics,ExceptionInfo *exception)
199</pre>
200
201<p>A description of each parameter follows:</p>
202
203<dd>
204</dd>
205
206<dd> </dd>
207<dl class="dl-horizontal">
208<dt>image</dt>
209<dd>the image. </dd>
210
211<dd> </dd>
212<dt>draw_info</dt>
213<dd>the draw info. </dd>
214
215<dd> </dd>
216<dt>metrics</dt>
217<dd>Return the font metrics in this structure. </dd>
218
219<dd> </dd>
220<dt>exception</dt>
221<dd>return any errors or warnings in this structure. </dd>
222
223<dd>  </dd>
224</dl>
225<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/annotate_8c.html" id="GetTypeMetrics">GetTypeMetrics</a></h2>
226
227<p>GetTypeMetrics() returns the following information for the specified font and text:</p>
228
229<pre class="text">
230    character width
231    character height
232    ascender
233    descender
234    text width
235    text height
236    maximum horizontal advance
237    bounds: x1
238    bounds: y1
239    bounds: x2
240    bounds: y2
241    origin: x
242    origin: y
243    underline position
244    underline thickness
245</pre>
246
247<p>The format of the GetTypeMetrics method is:</p>
248
249<pre class="text">
250MagickBooleanType GetTypeMetrics(Image *image,const DrawInfo *draw_info,
251  TypeMetric *metrics,ExceptionInfo *exception)
252</pre>
253
254<p>A description of each parameter follows:</p>
255
256<dd>
257</dd>
258
259<dd> </dd>
260<dl class="dl-horizontal">
261<dt>image</dt>
262<dd>the image. </dd>
263
264<dd> </dd>
265<dt>draw_info</dt>
266<dd>the draw info. </dd>
267
268<dd> </dd>
269<dt>metrics</dt>
270<dd>Return the font metrics in this structure. </dd>
271
272<dd> </dd>
273<dt>exception</dt>
274<dd>return any errors or warnings in this structure. </dd>
275
276<dd>  </dd>
277</dl>
278</div>
279  <footer class="magick-footer">
280    <p><a href="../script/support.php">Donate</a> •
281     <a href="../script/sitemap.php">Sitemap</a> •
282    <a href="../script/links.php">Related</a> •
283    <a href="../script/architecture.php">Architecture</a>
284</p>
285    <p><a href="annotate.php#">Back to top</a> •
286    <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> •
287    <a href="../script/contact.php">Contact Us</a></p>
288        <p><small1999-2016 ImageMagick Studio LLC</small></p>
289  </footer>
290</div><!-- /.container -->
291
292  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
293  <script src="http://nextgen.imagemagick.org/js/magick.php"></script>
294</div>
295</body>
296</html>
297