You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: text/index.html
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1851,7 +1851,7 @@ <h3>Bounding Box Overflow</h3>One of the biggest problems you will probably come
1851
1851
</tr>
1852
1852
</table><!-- ------ -->
1853
1853
<aname="annotate" id="annotate"></a>
1854
-
<h2>Annotate - Text Drawing Operator</h2>With IM version 6, a new font drawing operator, "<code><ahref="https://imagemagick.org/script/command-line-options.php?#annotate">-annotate</a></code>", was made available. This operator is in may ways much simpler that using a "<code><ahref="https://imagemagick.org/script/command-line-options.php?#draw">-draw</a></code> text" operation, but as it uses the '<code>annotate()</code>' API (Application Program Interface), it is also more powerful. While the operator does make use of the "<code><ahref="https://imagemagick.org/script/command-line-options.php?#draw">-draw</a></code>" primitives, it does so in a more complex way, such as expanding special <ahref="#escape_chars">escape characters</a> to add extra image information and even multiple lines, and applying a coordinate system transform to the drawn text to produce slants and rotations. Because of this, the operator is now the preferred text drawing operator for all ImageMagick text drawing and image annotation, and this is now reflected in these example pages. Here is a basic example using this operator.
1854
+
<h2>Annotate - Text Drawing Operator</h2>With IM version 6, a new font drawing operator, "<code><ahref="https://imagemagick.org/script/command-line-options.php?#annotate">-annotate</a></code>", was made available. This operator is in many ways much simpler than using a "<code><ahref="https://imagemagick.org/script/command-line-options.php?#draw">-draw</a></code> text" operation, but as it uses the '<code>annotate()</code>' API (Application Program Interface), it is also more powerful. While the operator does make use of the "<code><ahref="https://imagemagick.org/script/command-line-options.php?#draw">-draw</a></code>" primitives, it does so in a more complex way, such as expanding special <ahref="#escape_chars">escape characters</a> to add extra image information and even multiple lines, and applying a coordinate system transform to the drawn text to produce slants and rotations. Because of this, the operator is now the preferred text drawing operator for all ImageMagick text drawing and image annotation, and this is now reflected in these example pages. Here is a basic example using this operator.
</div>One of the extra features of the "<code><ahref="https://imagemagick.org/script/command-line-options.php?#annotate">-annotate</a></code>" operator is that it can rotate the X and Y axis of the drawn text completely separately to each other. This is done by providing the angle in which to rotate each axis as a 'image size' in the operators argument. Just to show how complex a single "<code><ahref="https://imagemagick.org/script/command-line-options.php?#annotate">-annotate</a></code>" operation can be, here is a boxed, stroked, and slanted image...
1866
+
</div>One of the extra features of the "<code><ahref="https://imagemagick.org/script/command-line-options.php?#annotate">-annotate</a></code>" operator is that it can rotate the X and Y axis of the drawn text completely separately to each other. This is done by providing the angle in which to rotate each axis as an 'image size' in the operator's argument. Just to show how complex a single "<code><ahref="https://imagemagick.org/script/command-line-options.php?#annotate">-annotate</a></code>" operation can be, here is a boxed, stroked, and slanted image...
</div>In this example all four annotate arguments are given. Specifically, X axis rotation, Y axis rotation, and the fonts X and Y position on the background image. Also note that the fill pattern (set with "<code><ahref="https://imagemagick.org/script/command-line-options.php?#tile">-tile</a></code>") is also slanted with the font. That is, because it is drawn using a sheared/rotated coordinate system, which also shears and fill pattern tiled within the drawn text. Further example of this shearing capability is the <ahref="../fonts/#slewed">Sheared Shadow Font</a> example. Compare that with the <ahref="../fonts/#slanted">Slanted Font</a> created with the equivalent "<code><ahref="https://imagemagick.org/script/command-line-options.php?#draw">-draw</a></code>" MVG string. For a table summarizing the effects of the "<code><ahref="https://imagemagick.org/script/command-line-options.php?#annotate">-annotate</a></code>" shearing operation, see <ahref="../misc/#annotate">Annotate Argument Usage</a>. For example, here is some slightly rotated text ...
1879
+
</div>In this example all four annotate arguments are given: X axis rotation, Y axis rotation, and the font's X and Y position on the background image. Also note that the fill pattern (set with "<code><ahref="https://imagemagick.org/script/command-line-options.php?#tile">-tile</a></code>") is also slanted with the font. That is, because it is drawn using a sheared/rotated coordinate system, which also shears the fill pattern tiled within the drawn text. A further example of this shearing capability is the <ahref="../fonts/#slewed">Sheared Shadow Font</a> example. Compare that with the <ahref="../fonts/#slanted">Slanted Font</a> created with the equivalent "<code><ahref="https://imagemagick.org/script/command-line-options.php?#draw">-draw</a></code>" MVG string. For a table summarizing the effects of the "<code><ahref="https://imagemagick.org/script/command-line-options.php?#annotate">-annotate</a></code>" shearing operation, see <ahref="../misc/#annotate">Annotate Argument Usage</a>. For example, here is some slightly rotated text...
</table>You can also add other information about the current image to the Annotated string using escape characters. For example lets overwrite the built-in "<code>rose:</code>" image with information about the images size. To center the text on the image we use a "<code><ahref="https://imagemagick.org/script/command-line-options.php?#gravity">-gravity</a></code>" setting, and turn off any and all rotations and offsets by using an "<code><ahref="https://imagemagick.org/script/command-line-options.php?#annotate">-annotate</a></code>" argument of '<code>0</code>'.
1921
+
</table>You can also add other information about the current image to the Annotated string using escape characters. For example, let's overwrite the built-in "<code>rose:</code>" image with information about the image's size. To center the text on the image we use a "<code><ahref="https://imagemagick.org/script/command-line-options.php?#gravity">-gravity</a></code>" setting, and turn off any and all rotations and offsets by using an "<code><ahref="https://imagemagick.org/script/command-line-options.php?#annotate">-annotate</a></code>" argument of '<code>0</code>'.
<tdalign="justify" width="100%"><fontsize="-1"><i>Note that position of the text in a centered "<code><ahref="#label">label:</a></code>" image may not exactly match the position of a centered "<code><ahref="https://imagemagick.org/script/command-line-options.php?#annotate">-annotate</a></code>" operation. The two methods follow completely different processing algorithms, and as such may not match. Especially when unusual fonts are involved.</i></font></td>
1985
+
<tdalign="justify" width="100%"><fontsize="-1"><i>Note that position of the text in a centered "<code><ahref="#label">label:</a></code>" image may not exactly match the position of a centered "<code><ahref="https://imagemagick.org/script/command-line-options.php?#annotate">-annotate</a></code>" operation. The two methods follow completely different processing algorithms, and as such may not match, especially when unusual fonts are involved.</i></font></td>
<h3>Auto Sized using 'Undercolor Box'</h3>Rather than using a "<code><ahref="#label">label:</a></code>" image, you can draw the font on a large canvas using an <ahref="#undercolor">Undercolor Box</a> and a <ahref="../draw/#stroke">large stroke width</a>, before trimming the canvas to fit. For example
@@ -1999,8 +1999,8 @@ <h3>Auto Sized using 'Undercolor Box'</h3>Rather than using a "<code><a href="#l
</div>The amount of space around the font can be adjusted using the "<code><ahref="https://imagemagick.org/script/command-line-options.php?#strokewidth">-strokewidth</a></code>" setting. The only important requirement is that the initial canvas be a color different to the background color, ('<code>lightblue</code>' in this case) and is larger than the final result. Just a word of warning, some fonts draw characters well outside the individual character drawing area. (For example see <ahref="#undercolor">Undercolor Box</a> above). In this case the above result will work, but may require you to use a transparent canvas, and then overlay the result over white (using an operation like "<code>-background white -flatten</code>" for example), to magick the unused and still transparent areas to white. However that character will likely be touching an edge of the resulting image. Basically you can't really win, in all situations, just try your best. <aname="coloring_text" id="coloring_text"></a>
2003
-
<h3>Coloring a Gray-scale Text Image</h3>I purposefully generated the above image as a grey-scale black and white image, as this can be used as a masking template. From a pure image like this you can then color the background and the foreground of image either separately or both at the same time. Here for example I use the <ahref="../color_mods/#level-colors">Level by Colors Operator</a>, "<code><ahref="https://imagemagick.org/script/command-line-options.php?#level-color">+level-color</a></code>", to globally modify the image colors so as to assign the foreground and background colors with specific values.
2002
+
</div>The amount of space around the font can be adjusted using the "<code><ahref="https://imagemagick.org/script/command-line-options.php?#strokewidth">-strokewidth</a></code>" setting. The only important requirement is that the initial canvas be a different color to the background color, ('<code>lightblue</code>' in this case) and is larger than the final result. Just a word of warning, some fonts draw characters well outside the individual character drawing area. (For example see <ahref="#undercolor">Undercolor Box</a> above). In this case the above result will work, but may require you to use a transparent canvas, and then overlay the result over white (using an operation like "<code>-background white -flatten</code>" for example), to magick the unused and still transparent areas to white. However that character will likely be touching an edge of the resulting image. Basically you can't really win in all situations, so just try your best. <aname="coloring_text" id="coloring_text"></a>
2003
+
<h3>Coloring a Gray-scale Text Image</h3>I purposefully generated the above image as a gray-scale black and white image, as this can be used as a masking template. From a pure image like this you can then color the background and the foreground of the image either separately or both at the same time. Here for example I use the <ahref="../color_mods/#level-colors">Level by Colors Operator</a>, "<code><ahref="https://imagemagick.org/script/command-line-options.php?#level-color">+level-color</a></code>", to globally modify the image colors so as to assign the foreground and background colors with specific values.
</div>The <ahref="../basics/#reverse">Reverse Operator</a> in the above is used to reorder the images, so the first image becomes the third 'masking' image of the composition. The foreground ("<code>plasma:</code>") image then becomes first, and the background in the middle. For other techniques of coloring a gray-scale image like this, see <ahref="../compose/#mask">Using a Mask to Limit the Composed Area</a>. And more generally <ahref="../masking/#masks">Using Masks with Images</a>. For other methods of generating gradients for tiling see <ahref="../canvas/#gradient">Gradients of Color</a>, <ahref="../canvas/#sparse-color">Sparse Points of Color</a>, and <ahref="../canvas/#plasma">Randomized Canvases</a>.
2031
+
</div>The <ahref="../basics/#reverse">Reverse Operator</a> in the above is used to reorder the images, so the first image becomes the third 'masking' image of the composition. The foreground ("<code>plasma:</code>") image then becomes first, and the background in the middle. For other techniques of coloring a gray-scale image like this, see <ahref="../compose/#mask">Using a Mask to Limit the Composed Area</a>. More generally see<ahref="../masking/#masks">Using Masks with Images</a>. For other methods of generating gradients for tiling see <ahref="../canvas/#gradient">Gradients of Color</a>, <ahref="../canvas/#sparse-color">Sparse Points of Color</a>, and <ahref="../canvas/#plasma">Randomized Canvases</a>.
0 commit comments