blob: fe0e3be800ee8e1f9d2c41f6fdae5008c42635f0 [file] [log] [blame]
cristy91469932014-07-25 11:00:25 +00001<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html version="-//W3C//DTD XHTML 1.1//EN"
4 xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6 xsi:schemaLocation="http://www.w3.org/1999/xhtml
7 http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">
cristy06f63f22012-10-31 00:50:07 +00008<head>
cristy91469932014-07-25 11:00:25 +00009 <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
10 <meta name=viewport content="width=device-width, initial-scale=0.3333334">
11 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4"/>
cristyffb69ed2010-12-25 00:06:48 +000012 <title>ImageMagick: MagickCore, C API for ImageMagick: Annotate an Image</title>
cristy91469932014-07-25 11:00:25 +000013 <meta http-equiv="content-language" content="en-US"/>
14 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
15 <meta http-equiv="reply-to" content="magick-users@imagemagick.org"/>
16 <meta name="application-name" content="ImageMagick"/>
17 <meta name="description" content="A collection of tools and libraries to read, write, and manipulate an image in any of the more popular image formats."/>
18 <meta name="application-url" content="http://www.imagemagick.org"/>
19 <meta name="generator" content="PHP"/>
20 <meta name="keywords" content="magickcore, c, api, for, imagemagick:, annotate, an, image, convert, edit, compose, image, pixel"/>
21 <meta name="rating" content="GENERAL"/>
22 <meta name="robots" content="INDEX, FOLLOW"/>
23 <meta name="generator" content="ImageMagick Studio LLC"/>
24 <meta name="author" content="ImageMagick Studio LLC"/>
25 <meta name="revisit-after" content="2 DAYS"/>
26 <meta name="resource-type" content="document"/>
27 <meta name="copyright" content="Copyright (c) 1999-2012 ImageMagick Studio LLC"/>
28 <meta name="distribution" content="Global"/>
29 <link rel="icon" href="../../images/wand.png"/>
30 <link rel="shortcut icon" href="../../images/wand.ico" type="images/x-icon"/>
31 <link rel="canonical" href="http://www.imagemagick.org" />
32 <link rel="meta" type="application/rdf+xml" title="ICI" href="http://imagemagick.org/ici.rdf"/>
cristy8ee7f242013-06-20 16:08:44 +000033
34 <!-- Add jQuery library -->
cristy91469932014-07-25 11:00:25 +000035 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
cristy8ee7f242013-06-20 16:08:44 +000036
37 <!-- Add mousewheel plugin (this is optional) -->
38 <script type="text/javascript" src="http://www.imagemagick.org/fancybox/lib/jquery.mousewheel-3.0.6.pack.js"></script>
39
40 <!-- Add fancyBox -->
cristy91469932014-07-25 11:00:25 +000041 <link rel="stylesheet" href="http://www.imagemagick.org/fancybox/source/jquery.fancybox.css?v=2.1.5" type="text/css" media="screen" />
42 <script type="text/javascript" src="http://www.imagemagick.org/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
cristy8ee7f242013-06-20 16:08:44 +000043
44 <!-- Optionally add helpers - button, thumbnail and/or media -->
cristy91469932014-07-25 11:00:25 +000045 <link rel="stylesheet" href="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-buttons.css?v=1.0.5" type="text/css" media="screen" />
46 <script type="text/javascript" src="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>
47 <script type="text/javascript" src="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-media.js?v=1.0.6"></script>
cristy8ee7f242013-06-20 16:08:44 +000048
cristy91469932014-07-25 11:00:25 +000049 <link rel="stylesheet" href="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-thumbs.css?v=1.0.7" type="text/css" media="screen" />
50 <script type="text/javascript" src="http://www.imagemagick.org/fancybox/source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>
cristy8ee7f242013-06-20 16:08:44 +000051
cristy72da67d2013-02-24 21:40:48 +000052 <script type="text/javascript">
cristy8ee7f242013-06-20 16:08:44 +000053 $(document).ready(function() {
54 $(".fancybox").fancybox();
55 });
cristy72da67d2013-02-24 21:40:48 +000056 </script>
cristy8ee7f242013-06-20 16:08:44 +000057
58 <!-- ImageMagick style -->
59 <style type="text/css" media="all">
60 @import url("../../www/magick.css");
61 </style>
cristy06f63f22012-10-31 00:50:07 +000062</head>
63
64<body id="www-imagemagick-org">
cristy8ee7f242013-06-20 16:08:44 +000065
cristy91469932014-07-25 11:00:25 +000066<script type="text/javascript">
67 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
68 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
69 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
70 })(window,document,'offline-script','//www.google-analytics.com/analytics.js','ga');
cristy8ee7f242013-06-20 16:08:44 +000071
cristy91469932014-07-25 11:00:25 +000072 ga('create', 'UA-40133312-1', 'imagemagick.org');
73 ga('send', 'pageview');
74</script>
cristy8ee7f242013-06-20 16:08:44 +000075
cristy06f63f22012-10-31 00:50:07 +000076<div class="titlebar">
77<div style="margin: 17px auto; float: left;">
78 <script type="text/javascript">
79 <!--
80 google_ad_client = "pub-3129977114552745";
81 google_ad_slot = "5439289906";
82 google_ad_width = 728;
83 google_ad_height = 90;
84 //-->
85 </script>
cristy91469932014-07-25 11:00:25 +000086 <script type="text/javascript"
87 src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
88 </script>
cristy06f63f22012-10-31 00:50:07 +000089</div>
cristy417eeb12013-07-28 18:48:22 +000090<a href="../../discourse-server">
cristy91469932014-07-25 11:00:25 +000091 <img src="../../images/logo.jpg"
92 alt="ImageMagick Logo" width="123" height="118"
93 style="width: 123px; height: 118px; border: 0px; float: right;" /></a>
cristyf1b8a092014-02-20 15:46:11 +000094<a href="http://www.imagemagick.org/ImageMagick-7.0.0/index.html">
cristy91469932014-07-25 11:00:25 +000095 <img src="../../images/sprite.jpg"
96 alt="ImageMagick Sprite" width="114" height="118"
97 style="width: 114px; height: 118px; border: 0px; float: right;" /></a>
cristy06f63f22012-10-31 00:50:07 +000098</div>
99
100<div class="westbar">
101
cristy3ed852e2009-09-05 21:47:34 +0000102<div class="menu">
cristyf1b8a092014-02-20 15:46:11 +0000103 <a title="About ImageMagick" href="http://www.imagemagick.org/ImageMagick-7.0.0/index.html">About ImageMagick</a>
cristy3ed852e2009-09-05 21:47:34 +0000104</div>
cristy3ed852e2009-09-05 21:47:34 +0000105<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000106 <a title="Binary Releases" href="../../www/binary-releases.html">Binary Releases</a>
cristybb503372010-05-27 20:51:26 +0000107</div>
108<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000109 <a title="Binary Release: Unix" href="../../www/binary-releases.html#unix">Unix</a>
cristybb503372010-05-27 20:51:26 +0000110</div>
111<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000112 <a title="Binary Release: MacOS X" href="../../www/binary-releases.html#macosx">Mac OS X</a>
cristybb503372010-05-27 20:51:26 +0000113</div>
114<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000115 <a title="Binary Release: iOS" href="../../www/binary-releases.html#iOS">iOS</a>
cristyda16f162011-02-19 23:52:17 +0000116</div>
117<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000118 <a title="Binary Release: Windows" href="../../www/binary-releases.html#windows">Windows</a>
cristybb503372010-05-27 20:51:26 +0000119</div>
cristy06f63f22012-10-31 00:50:07 +0000120<div class="sep"></div>
cristybb503372010-05-27 20:51:26 +0000121<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000122 <a title="Command-line Tools" href="../../www/command-line-tools.html">Command-line Tools</a>
cristy3ed852e2009-09-05 21:47:34 +0000123</div>
124<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000125 <a title="Command-line Tools: Processing" href="../../www/command-line-processing.html">Processing</a>
cristy3ed852e2009-09-05 21:47:34 +0000126</div>
127<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000128 <a title="Command-line Tools: Options" href="../../www/command-line-options.html">Options</a>
cristy3ed852e2009-09-05 21:47:34 +0000129</div>
130<div class="sub">
cristy83a272e2010-05-07 20:40:35 +0000131 <a title="Command-line Tools: Usage" href="http://www.imagemagick.org/Usage/">Usage</a>
cristy3ed852e2009-09-05 21:47:34 +0000132</div>
133<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000134 <a title="Program Interfaces" href="../../www/api.html">Program Interfaces</a>
cristy3ed852e2009-09-05 21:47:34 +0000135</div>
136<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000137 <a title="Program Interface: MagickWand" href="../../www/magick-wand.html">MagickWand</a>
cristy3ed852e2009-09-05 21:47:34 +0000138</div>
139<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000140 <a title="Program Interface: MagickCore" href="../../www/magick-core.html">MagickCore</a>
cristy3ed852e2009-09-05 21:47:34 +0000141</div>
142<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000143 <a title="Program Interface: PerlMagick" href="../../www/perl-magick.html">PerlMagick</a>
cristy3ed852e2009-09-05 21:47:34 +0000144</div>
145<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000146 <a title="Program Interface: Magick++" href="../../www/magick++.html">Magick++</a>
cristy3ed852e2009-09-05 21:47:34 +0000147</div>
cristy06f63f22012-10-31 00:50:07 +0000148<div class="sep"></div>
cristy91469932014-07-25 11:00:25 +0000149<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000150 <a title="Install from Source" href="../../www/install-source.html">Install from Source</a>
cristy3ed852e2009-09-05 21:47:34 +0000151</div>
152<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000153 <a title="Install from Source: Unix" href="../../www/install-source.html#unix">Unix</a>
cristy3ed852e2009-09-05 21:47:34 +0000154</div>
155<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000156 <a title="Install from Source: Windows" href="../../www/install-source.html#windows">Windows</a>
cristy3ed852e2009-09-05 21:47:34 +0000157 </div>
158<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000159 <a title="Resources" href="../../www/resources.html">Resources</a>
cristy3ed852e2009-09-05 21:47:34 +0000160</div>
cristybb503372010-05-27 20:51:26 +0000161<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000162 <a title="Architecture" href="../../www/architecture.html">Architecture</a>
cristybb503372010-05-27 20:51:26 +0000163</div>
cristy3ed852e2009-09-05 21:47:34 +0000164<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000165 <a title="Download" href="../../www/download.html">Download</a>
cristy3ed852e2009-09-05 21:47:34 +0000166</div>
cristy06f63f22012-10-31 00:50:07 +0000167<div class="sep"></div>
cristy3ed852e2009-09-05 21:47:34 +0000168<div class="menu">
cristy3dfa2192013-02-24 22:46:05 +0000169 <a title="Search" href="http://www.imagemagick.org/script/search.php">Search</a>
cristy3ed852e2009-09-05 21:47:34 +0000170</div>
cristy06f63f22012-10-31 00:50:07 +0000171<div class="sep"></div>
cristy3ed852e2009-09-05 21:47:34 +0000172<div class="menu">
cristyd8833bf2013-02-24 22:14:53 +0000173 <a title="Site Map" href="../../www/sitemap.html">Site Map</a>
cristy3ed852e2009-09-05 21:47:34 +0000174</div>
cristy91469932014-07-25 11:00:25 +0000175<div class="sub">
cristyd8833bf2013-02-24 22:14:53 +0000176 <a title="Site Map: Links" href="../../www/links.html">Links</a>
cristy3ed852e2009-09-05 21:47:34 +0000177</div>
cristy06f63f22012-10-31 00:50:07 +0000178<div class="sep"></div>
cristy06f63f22012-10-31 00:50:07 +0000179</div>
180
181<div class="eastbar">
cristy91469932014-07-25 11:00:25 +0000182 <script type="text/javascript">
183 /* <![CDATA[ */
184 window.___gcfg = {
185 lang: 'en-US'
186 };
187
188 (function() {
189 var po = document.createElement('offline-script');
190 po.type = 'text/javascript';
191 po.async = true;
192 po.src = 'https://apis.google.com/js/plusone.js';
193 var script = document.getElementsByTagName('offline-script')[0];
194 script.parentNode.insertBefore(po, script);
195 })();
196 var gplusone = document.getElementById("gplusone");
197 gplusone.setAttribute("data-size","medium");
198 gplusone.setAttribute("data-count","true");
199 /* ]]> */
200 </script>
201 <script type="text/javascript">
202 /* <![CDATA[ */
203 (function() {
204 var po = document.createElement('offline-script'), t = document.getElementsByTagName('offline-script')[0];
205 po.type = 'text/javascript';
206 po.async = true;
207 po.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
208 var script = document.getElementsByTagName('offline-script')[0];
209 script.parentNode.insertBefore(po, script);
210 })();
211 /* ]]> */
212 </script>
cristyf1b8a092014-02-20 15:46:11 +0000213 <div> <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://www.imagemagick.org/"></a></div>
cristy8ee7f242013-06-20 16:08:44 +0000214 <noscript>
215 <a href="http://flattr.com/thing/947300/Convert-Edit-And-Compose-Images" target="_blank">
cristy91469932014-07-25 11:00:25 +0000216 <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" width="93" height="20" border="0" /></a>
cristy8ee7f242013-06-20 16:08:44 +0000217 </noscript>
cristy91469932014-07-25 11:00:25 +0000218 <div class="g-plusone" data-size="standard" data-count="true"></div>
cristy06f63f22012-10-31 00:50:07 +0000219</div>
220
221<div class="main">
222
cristy20398432011-08-11 01:31:50 +0000223<h1>Module annotate Methods</h1>
cristy91469932014-07-25 11:00:25 +0000224<p class="navigation-index">[<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>
cristy3ed852e2009-09-05 21:47:34 +0000225
cristy20398432011-08-11 01:31:50 +0000226<h2><a href="http://www.imagemagick.org/api/MagickCore/annotate_8c.html" id="AnnotateImage">AnnotateImage</a></h2>
227<div class="doc-section">
228
229<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>
230
231<pre class="text">
232 b file size in bytes.
233 c comment.
234 d directory in which the image resides.
235 e extension of the image file.
236 f original filename of the image.
237 h height of image.
238 i filename of the image.
239 k number of unique colors.
240 l image label.
241 m image file format.
242 n number of images in a image sequence.
243 o output image filename.
244 p page number of the image.
245 q image depth (8 or 16).
246 q image depth (8 or 16).
247 s image scene number.
248 t image filename without any extension.
249 u a unique temporary filename.
250 w image width.
251 x x resolution of the image.
252 y y resolution of the image.
253</pre>
254
255<p>The format of the AnnotateImage method is:</p>
256
257<pre class="code">
258 MagickBooleanType AnnotateImage(Image *image,DrawInfo *draw_info)
259</pre>
260
261<p>A description of each parameter follows:</p>
262
263<h5>image</h5>
264<p>the image.</p>
265
266<h5>draw_info</h5>
267<p>the draw info.</p>
268
269 </div>
270<h2><a href="http://www.imagemagick.org/api/MagickCore/annotate_8c.html" id="FormatMagickCaption">FormatMagickCaption</a></h2>
271<div class="doc-section">
272
273<p>FormatMagickCaption() formats a caption so that it fits within the image width. It returns the number of lines in the formatted caption.</p>
274
275<p>The format of the FormatMagickCaption method is:</p>
276
277<pre class="code">
278 ssize_t FormatMagickCaption(Image *image,DrawInfo *draw_info,
279 const MagickBooleanType split,TypeMetric *metrics,char **caption)
280</pre>
281
282<p>A description of each parameter follows.</p>
283
284<h5>image</h5>
285<p>The image.</p>
286
287<h5>draw_info</h5>
288<p>the draw info.</p>
289
290<h5>split</h5>
291<p>when no convenient line breaks-- insert newline.</p>
292
293<h5>metrics</h5>
294<p>Return the font metrics in this structure.</p>
295
296<h5>caption</h5>
297<p>the caption.</p>
298
299 </div>
300<h2><a href="http://www.imagemagick.org/api/MagickCore/annotate_8c.html" id="GetMultilineTypeMetrics">GetMultilineTypeMetrics</a></h2>
301<div class="doc-section">
302
303<p>GetMultilineTypeMetrics() returns the following information for the specified font and text:</p>
304
305<pre class="text">
306 character width
307 character height
308 ascender
309 descender
310 text width
311 text height
312 maximum horizontal advance
313 bounds: x1
314 bounds: y1
315 bounds: x2
316 bounds: y2
317 origin: x
318 origin: y
319 underline position
320 underline thickness
321</pre>
322
323<p>This method is like GetTypeMetrics() but it returns the maximum text width and height for multiple lines of text.</p>
324
325<p>The format of the GetMultilineTypeMetrics method is:</p>
326
327<pre class="code">
328 MagickBooleanType GetMultilineTypeMetrics(Image *image,
329 const DrawInfo *draw_info,TypeMetric *metrics)
330</pre>
331
332<p>A description of each parameter follows:</p>
333
334<h5>image</h5>
335<p>the image.</p>
336
337<h5>draw_info</h5>
338<p>the draw info.</p>
339
340<h5>metrics</h5>
341<p>Return the font metrics in this structure.</p>
342
343 </div>
344<h2><a href="http://www.imagemagick.org/api/MagickCore/annotate_8c.html" id="GetTypeMetrics">GetTypeMetrics</a></h2>
345<div class="doc-section">
346
347<p>GetTypeMetrics() returns the following information for the specified font and text:</p>
348
349<pre class="text">
350 character width
351 character height
352 ascender
353 descender
354 text width
355 text height
356 maximum horizontal advance
357 bounds: x1
358 bounds: y1
359 bounds: x2
360 bounds: y2
361 origin: x
362 origin: y
363 underline position
364 underline thickness
365</pre>
366
367<p>The format of the GetTypeMetrics method is:</p>
368
369<pre class="code">
370 MagickBooleanType GetTypeMetrics(Image *image,const DrawInfo *draw_info,
371 TypeMetric *metrics)
372</pre>
373
374<p>A description of each parameter follows:</p>
375
376<h5>image</h5>
377<p>the image.</p>
378
379<h5>draw_info</h5>
380<p>the draw info.</p>
381
382<h5>metrics</h5>
383<p>Return the font metrics in this structure.</p>
384
385 </div>
cristy06f63f22012-10-31 00:50:07 +0000386
387</div>
388
389<div id="linkbar">
cristyac1b4322013-07-28 13:58:06 +0000390 <span id="linkbar-west"> </span>
cristy8ee7f242013-06-20 16:08:44 +0000391
cristy06f63f22012-10-31 00:50:07 +0000392 <span id="linkbar-center">
cristy44cbd482013-08-04 20:53:36 +0000393 <a href="../../discourse-server">Discourse Server</a>
cristy91469932014-07-25 11:00:25 +0000394 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
cristy44cbd482013-08-04 20:53:36 +0000395 <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Studio</a>
cristy8ee7f242013-06-20 16:08:44 +0000396 <a href="http://jqmagick.imagemagick.org/">JqMagick</a>
cristy06f63f22012-10-31 00:50:07 +0000397 </span>
cristyac1b4322013-07-28 13:58:06 +0000398 <span id="linkbar-east"> </span>
cristy44cbd482013-08-04 20:53:36 +0000399</div>
400<div class="footer">
cristy91469932014-07-25 11:00:25 +0000401 <span id="footer-west">© 1999-2014 ImageMagick Studio LLC</span>
cristy44cbd482013-08-04 20:53:36 +0000402 <span id="footer-east"> <a href="../../www/contact.html">Contact the Wizards</a></span>
403</div>
404<div style="clear: both; margin: 0; width: 100%; "></div>
cristy06f63f22012-10-31 00:50:07 +0000405</body>
406</html>