summary refs log tree commit diff
path: root/ppmlabel.html
blob: 8e38955b7aeb381dfa25a96b30a59c25816df729 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD><TITLE>Ppmlabel User Manual</TITLE></HEAD>
<BODY>

<H1>ppmlabel</H1>
Updated: 15 April 2006
<BR>
<A HREF="#index">Table Of Contents</A>

<H2>NAME</H2>
ppmlabel - add text to a PPM image

<H2 id="synopsis">SYNOPSIS</H2>

<B>ppmlabel</B>

[<B>-angle</B> <I>angle</I>]

[<B>-background</B> { <B>transparent</B> | <I>color</I> } ]

[<B>-color</B> <I>color</I>]

[<B>-file</B> <I>filename</I>]

[<B>-size</B>

<I>textsize</I>]

[<B>-text</B> <I>text_string</i>]

[<B>-x</B> <I>column</I>]

[<B>-y</B> <I>row</I>]

...

[<I>ppmfile</I>]


<h2 id="example">EXAMPLE</h2>

<pre>
<code>
    ppmlabel -x 50 -y 50 -text hello \
             -angle -30 -text there \
             testimg.ppm 
</code>
</pre>

<H2 id="description">DESCRIPTION</H2>

<p>This program is part of <a href="index.html">Netpbm</a>.

<p><B>ppmlabel</B> uses the text drawing facilities of <B>libnetpbm</B>'s
&quot;ppmd&quot; component to add text to a PBM image.  You control
the location, size, baseline angle, color of the text, and background
color (if any) with command line arguments.  You can specify the text
on the command line or supply it in files.

<p>You can add any number of separate labels in a single invocation of
<B>ppmlabel</B>, limited only by any restrictions your environment has
on the number and size of program arguments (e.g. a shell's command 
size limit).

<P>If you don't specify <I>ppmfile</I>, <B>ppmlabel</B> reads its input
PPM image from Standard Input.

<P>The output image goes to Standard Output.

<P>A more sophisticated way to add a label to an image is to use
<b>pbmtext</b> or <b>pbmtextps</b> to create an image of the text, then
<b>pamcomp</b> to overlay it onto the base image.

<p>Another more general program is <b>ppmdraw</b>.  It is slightly harder
to use for simple labelling.

<H2 id="options">OPTIONS</H2>

<p>The arguments on the <B>ppmlabel</B> command line are not options in
the strict sense; they are commands which control the placement and
appearance of the text being added to the input image.  They are
executed left to right, and any number of arguments may appear.

<P>You can abbreviate any option to its shortest unique prefix.

<DL COMPACT>
<DT><B>-angle</B><I> angle</I>

<DD>This option sets the angle of the baseline of subsequent text.
<I>angle</I> is an integral number of degrees, measured
counterclockwise from the row axis of the image.

<DT><B>-background</b> { <b>transparent</b> | <I>color</I> }

<DD>If the argument is <B>transparent</B>, <b>ppmlabel</b> draws the
text over the existing pixels in the image.  If you specify a
<I>color</I> (see the <B>-color</B> option below for information on
how to specify colors), <b>ppmlabel</b> generates background rectangles
enclosing subsequent text, and those rectangles are filled with that
color.

<DT><B>-color</B> <I>color</I>

<DD>This option sets the color for subsequent text.

<P>Specify the color (<i>color</i>) as described for the <a
href="libppm.html#colorname">argument of the <b>ppm_parsecolor()</b>
library routine</a>.

<p><b>-colour</b> is an acceptable alternate spelling.

<DT><B>-file</B> <I>filename</I>

<DD>This option causes <b>ppmlabel</b> to read lines of text from the file
named <I>filename</I> and draw it on successive lines.

<DT><B>-size</B> <I>textsize</I>

<DD>This option sets the height of the tallest characters above the
baseline to <I>textsize</I> pixels.

<DT><B>-text</B> <I>text_string</I>

<DD>This option causes <b>ppmlabel</b> to draw the specified text
string.  It advances the location for subsequent text down 1.75 times
the current <i>textsize</i>.  That lets you draw multiple lines of
text in a reasonable manner without specifying the position of each
line.
<p>
Note that if you invoke <b>ppmlabel</b> via a shell command and your
text string contains spaces, you'll have to quote it so the shell treats
the whole string as a single token.  E.g.
<pre>
  $ ppmlabel -text "this is my text" baseimage.ppm &gt;annotatedimage.ppm
</pre>


<DT><B>-x</B> <I>column</I>

<DD>This option sets the pixel column at which subsequent text will
be left justified.  Depending on the shape of the first character, the
actual text may begin a few pixels to the right of this point.

<DT><B>-y</B> <I>row</I>

<DD>This option sets the pixel row which will form the baseline of
subsequent text.  Characters with descenders, such as "y," will extend
below this line.  

</DL>

<H2 id="limitations">LIMITATIONS</H2>

<P>Text strings are restricted to 7 bit ASCII.  The text font used by
<B>ppmlabel</B> doesn't include definitions for 8 bit ISO 8859/1 characters.

<P>When drawing multiple lines of text with a non-transparent
background, it should probably fill the space between the lines with
the background color.  This is tricky to get right when the text is
rotated to a non-orthogonal angle.

<H2 id="seealso">SEE ALSO</H2>


<B><A HREF="ppmmake.html">ppmmake</A></B>,
<B><A HREF="ppmdraw.html">ppmdraw</A></B>,
<B><A HREF="pbmtext.html">pbmtext</A></B>,
<B><A HREF="pbmtextps.html">pbmtextps</A></B>,
<B><A HREF="pamcomp.html">pamcomp</A></B>,
<B><A HREF="ppm.html">ppm</A></B>


<H2 id="author">AUTHOR</H2>

Copyright (C) 1995 by John Walker (<A HREF="mailto:kelvin@fourmilab.ch">kelvin@fourmilab.ch</A>)<BR>
WWW home page: <A HREF="http://www.fourmilab.ch/">http://www.fourmilab.ch/</A><BR>

<P>Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby granted,
without any conditions or restrictions.  This software is provided
``as is'' without express or implied warranty.

<HR>
<H2 id="index">Table Of Contents</H2>
<UL>
<LI><A HREF="#synopsis">SYNOPSIS</A>
<LI><A HREF="#example">EXAMPLE</A>
<LI><A HREF="#description">DESCRIPTION</A>
<LI><A HREF="#options">OPTIONS</A>
<LI><A HREF="#limitations">LIMITATIONS</A>
<LI><A HREF="#seealso">SEE ALSO</A>
<LI><A HREF="#author">AUTHOR</A>
</UL>
</BODY>
</HTML>