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