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