about summary refs log tree commit diff
path: root/pamtosvg.html
blob: fc02a335948d56464ba5ea55ae8431e348d2f24a (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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN">
<html><head><title>Pamtosvg User Manual</title></head>
<body>
<h1>pamtosvg</h1>
Updated: 23 April 2006
<br>
<a href="#index">Table Of Contents</a>

<h2>NAME</h2>
pamtosvg - convert a Netpbm image to a SVG (Scalable Vector Graphics) image

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

<b>pamtosvg</b>

[<b>-background-color=</b><i>colorname</i>]
[<b>-centerline</b>]
[<b>-corner-threshold=</b><i>angle</i>]
[<b>-corner-always-threshold=</b><i>angle</i>]
[<b>-corner-surround=</b><i>integer</i>]
[<b>-tangent-surround=</b><i>integer</i>]
[<b>-error-threshold=</b><i>float</i>]
[<b>-filter-iterations=</b><i>count</i>]
[<b>-line-reversion-threshold=</b><i>float</i>]
[<b>-line-threshold=</b><i>float</i>]
[<b>-width-weight-factor=</b><i>float</i>]
[<b>-preserve-width</b>]
[<b>-remove-adjacent-corners</b>]
[<b>-log</b>]
[<b>-report-progress</b>] [<i>pnmfile</i>]

<p>Minimum unique abbreviation of option is acceptable.  You may use
double hyphens instead of single hyphen to denote options.  You may use
white space in place of the equals sign to separate an option name
from its value.

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

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

<p><b>pamtosvg</b> reads a PNM image as input and produce an SVG
(Scalable Vector Graphics) image as output.  Thus, it traces curves
in the input image and creates a set of splines that represent the
image.

<p>SVG is a vector image format, which means it describes curves that
compose an image.  By contrast, PNM is a raster format, which means it
describes dots that compose an image.  The main practical difference
between the two types is that you can scale vector images better.  A
vector image also takes a lot less data to describe an image if the
image is composed of simple curves.

<p>That means it is really an understatement to say that <b>pamtosvg</b>
is an image format converter.  It's really an image tracer.  Its main job
is to trace a raster image and find the lines in it.  It then represents
its findings in SVG format.

<p><b>pamtosvg</b> does the same kind of thing that StreamLine,
CorelTrace, and Autotrace do.  It is in fact derived from Autotrace.

<p>SVG is a gigantic format, capable of amazing things.  <b>pamtosvg</b>
exploits only a morsel of it.  The SVG image produced by <b>pamtosvg</b>
consists of a single &lt;svg&gt; element, which has a "width"
attribute and a "height" attribute.  The value of that element
is composed of &lt;path&gt; elements.  That's it.

<p>In the SVG output, distances are unitless, with one unit corresponding
to one pixel of the input.

<p>So that <b>pamtosvg</b> will find simple curves in the image, you
may want to remove speckles from it with <b>pbmclean</b> and consolidate
multiple shades into single colors with <b>pnmquant</b> first.

<p>For more information on SVG, see <a
href="http://www.w3.org/Graphics/SVG/">the Worldwide Web Consortium's
SVG web page</a>.


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

<p>In addition to the options common to all programs based on libnetpbm
(most notably <b>-quiet</b>, see <a href="index.html#commonoptions">
Common Options</a>), <b>pamtosvg</b> recognizes the following
command line options:

<dl compact>
<dt><b>-background-color=</b><i>colorname</i>

<dd>Treat the specified color as the background color and ignore it.

<p>If you don't specify this option, <b>pamtosvg</b> does not recognize
any background color.

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

<dt><b>-centerline</b>

<dd>Trace an object's centerline.

<p>By default, <b>pamtosvg</b> traces an object's outline.

<dt><b>-corner-always-threshold=</b><i>angle</i>

<dd>Consider any angle at a pixel which falls below angle <i>angle</i>
(in decimal floating point degrees) as a corner, even if it is
bordered by other corner pixels.  Default is 60 degrees.

<dt><b>-corner-surround=</b><i>integer</i>

<dd>Consider the specified number of pixels on either side of a
point when determining if that point is a corner.  Default is 4.

<dt><b>-corner-threshold=</b><i>angle</i>

<dd>Consider any pixel which forms an angle with its predecessors and
successors that is smaller than <i>angle</i> (in decimal floating
point degrees) as a corner.  Default is 100.

<dt><b>-error-threshold=</b><i>float</i>

<dd>Subdivide fitted curves that are offset by a number of pixels
exceeding the specified number.  Default is 2.0.

<dt><b>-filter-iterations=</b><i>integer</i>

<dd>Smooth the curve the specified number of times prior to fitting
Default is 4.

<dt><b>-line-reversion-threshold=</b><i>float</i>

<dd>When a spline is closer to a straight line than the specified real
number weighted by the square of the curve length, maintain it as a
straight line, even if it is a list with curves.

<p>Default is .01.

<dt><b>-line-threshold=</b><i>float</i>

<dd>If a spline does not deviate from the straight line defined by its
endpoints by more than the specified number of pixels, then treat it
as a straight line.

<p>Default is 1.

<dt><b>-log</b>

<dd>Create a log of the curve tracing process (suitable for
debugging).  Put it in the file named <i>inputfile</i><b>.log</b> in
the current directory, where <i>inputfile</i> is the root of the input
file name, or "pamtosvg" if the input is from Standard Input
or a file with a weird name.

<dt><b>-preserve-width</b>

<dd>Preserve line width prior to thinning.  Meaningful only with
<b>-centerline</b>.

<dt><b>remove-adjacent-corners</b>

<dd>Remove adjacent corners.

<dt><b>-report-progress</b>

<dd>Report the progress of the tracing to Standard Error as it happens.

<dt><b>-tangent-surround</b>

<dd>Consider the specified number of points to either side of a point
when computing the tangent at that point.  Default is 3.

<dt><b>-width-weight-factor</b>

<dd>Weight factor for fitting the linewidth.

</dl>

<h2 id="applicationnotes">APPLICATION NOTES</h2>

<p>A convenient way to view an SVG document is with a web browser.  Many
understand a file whose name ends in ".svg" to be an SVG
image and can render it.


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

<b><a href="pnmquant.html">pnmquant</a></b>,
<b><a href="pbmclean.html">pbmclean</a></b>,
<a href="pnm.html">pnm</a>,
<a href="http://autotrace.sourceforge.net">Autotrace</a>

<h2 id="history">HISTORY</h2>

<p><b>pamtosvg</b> was added to Netpbm in Version 10.33 (March 2006).

<p>The core of <b>pamtosvg</b> -- the curve tracing logic -- was taken
nearly unmodified from Martin Weber's Autotrace program.  That program
duplicates a lot of Netpbm function, so <b>pamtosvg</b> is a much leaner
program.

<p>Bryan Henderson created <b>pamtosvg</b>, basically just by adapting
Autotrace to Netpbm.

<p>Autotrace was first released in 2000 and updates were released
through 2002.  A number of people wrote the code in it, but Masatake
Yamato and Martin Weber appear to be the principal creators of it.

<p>As of June 2006, there was a <a
href="http://autotrace.sourceforge.net">Sourceforge project</a> for it.

<hr>
<h2 id="index">Table Of Contents</h2>
<ul>
<li><a href="#synopsis">SYNOPSIS</a>
<li><a href="#description">DESCRIPTION</a>
<li><a href="#options">OPTIONS</a>
<li><a href="#applicationnotes">APPLICATION NOTES</a>
<li><a href="#seealso">SEE ALSO</a>
<li><a href="#history">HISTORY</a>
</ul>
</body>
</html>