| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN"> |
| 2 |
<html><head><title>Pamtosvg User Manual</title></head> |
| 3 |
<body> |
| 4 |
<h1>pamtosvg</h1> |
| 5 |
Updated: 23 April 2006 |
| 6 |
<br> |
| 7 |
<a href="#index">Table Of Contents</a> |
| 8 |
|
| 9 |
<h2>NAME</h2> |
| 10 |
pamtosvg - convert a Netpbm image to a SVG (Scalable Vector Graphics) image |
| 11 |
|
| 12 |
<h2 id="synopsis">SYNOPSIS</h2> |
| 13 |
|
| 14 |
<b>pamtosvg</b> |
| 15 |
|
| 16 |
[<b>-background-color=</b><i>colorname</i>] |
| 17 |
[<b>-centerline</b>] |
| 18 |
[<b>-corner-threshold=</b><i>angle</i>] |
| 19 |
[<b>-corner-always-threshold=</b><i>angle</i>] |
| 20 |
[<b>-corner-surround=</b><i>integer</i>] |
| 21 |
[<b>-tangent-surround=</b><i>integer</i>] |
| 22 |
[<b>-error-threshold=</b><i>float</i>] |
| 23 |
[<b>-filter-iterations=</b><i>count</i>] |
| 24 |
[<b>-line-reversion-threshold=</b><i>float</i>] |
| 25 |
[<b>-line-threshold=</b><i>float</i>] |
| 26 |
[<b>-width-weight-factor=</b><i>float</i>] |
| 27 |
[<b>-preserve-width</b>] |
| 28 |
[<b>-remove-adjacent-corners</b>] |
| 29 |
[<b>-log</b>] |
| 30 |
[<b>-report-progress</b>] [<i>pnmfile</i>] |
| 31 |
|
| 32 |
<p>Minimum unique abbreviation of option is acceptable. You may use |
| 33 |
double hyphens instead of single hyphen to denote options. You may use |
| 34 |
white space in place of the equals sign to separate an option name |
| 35 |
from its value. |
| 36 |
|
| 37 |
<h2 id="description">DESCRIPTION</h2> |
| 38 |
|
| 39 |
<p>This program is part of <a href="index.html">Netpbm</a>. |
| 40 |
|
| 41 |
<p><b>pamtosvg</b> reads a PNM image as input and produce an SVG |
| 42 |
(Scalable Vector Graphics) image as output. Thus, it traces curves |
| 43 |
in the input image and creates a set of splines that represent the |
| 44 |
image. |
| 45 |
|
| 46 |
<p>SVG is a vector image format, which means it describes curves that |
| 47 |
compose an image. By contrast, PNM is a raster format, which means it |
| 48 |
describes dots that compose an image. The main practical difference |
| 49 |
between the two types is that you can scale vector images better. A |
| 50 |
vector image also takes a lot less data to describe an image if the |
| 51 |
image is composed of simple curves. |
| 52 |
|
| 53 |
<p>That means it is really an understatement to say that <b>pamtosvg</b> |
| 54 |
is an image format converter. It's really an image tracer. Its main job |
| 55 |
is to trace a raster image and find the lines in it. It then represents |
| 56 |
its findings in SVG format. |
| 57 |
|
| 58 |
<p><b>pamtosvg</b> does the same kind of thing that StreamLine, |
| 59 |
CorelTrace, and Autotrace do. It is in fact derived from Autotrace. |
| 60 |
|
| 61 |
<p>SVG is a gigantic format, capable of amazing things. <b>pamtosvg</b> |
| 62 |
exploits only a morsel of it. The SVG image produced by <b>pamtosvg</b> |
| 63 |
consists of a single <svg> element, which has a "width" |
| 64 |
attribute and a "height" attribute. The value of that element |
| 65 |
is composed of <path> elements. That's it. |
| 66 |
|
| 67 |
<p>In the SVG output, distances are unitless, with one unit corresponding |
| 68 |
to one pixel of the input. |
| 69 |
|
| 70 |
<p>So that <b>pamtosvg</b> will find simple curves in the image, you |
| 71 |
may want to remove speckles from it with <b>pbmclean</b> and consolidate |
| 72 |
multiple shades into single colors with <b>pnmquant</b> first. |
| 73 |
|
| 74 |
<p>For more information on SVG, see <a |
| 75 |
href="http://www.w3.org/Graphics/SVG/">the Worldwide Web Consortium's |
| 76 |
SVG web page</a>. |
| 77 |
|
| 78 |
|
| 79 |
<h2 id="options">OPTIONS</h2> |
| 80 |
|
| 81 |
<p>In addition to the options common to all programs based on libnetpbm |
| 82 |
(most notably <b>-quiet</b>, see <a href="index.html#commonoptions"> |
| 83 |
Common Options</a>), <b>pamtosvg</b> recognizes the following |
| 84 |
command line options: |
| 85 |
|
| 86 |
<dl compact> |
| 87 |
<dt><b>-background-color=</b><i>colorname</i> |
| 88 |
|
| 89 |
<dd>Treat the specified color as the background color and ignore it. |
| 90 |
|
| 91 |
<p>If you don't specify this option, <b>pamtosvg</b> does not recognize |
| 92 |
any background color. |
| 93 |
|
| 94 |
<p>Specify the color (<i>colorname</i>) as described for the <a |
| 95 |
href="libnetpbm_image.html#colorname">argument of the <b>pnm_parsecolor()</b> |
| 96 |
library routine</a>. |
| 97 |
|
| 98 |
<dt><b>-centerline</b> |
| 99 |
|
| 100 |
<dd>Trace an object's centerline. |
| 101 |
|
| 102 |
<p>By default, <b>pamtosvg</b> traces an object's outline. |
| 103 |
|
| 104 |
<dt><b>-corner-always-threshold=</b><i>angle</i> |
| 105 |
|
| 106 |
<dd>Consider any angle at a pixel which falls below angle <i>angle</i> |
| 107 |
(in decimal floating point degrees) as a corner, even if it is |
| 108 |
bordered by other corner pixels. Default is 60 degrees. |
| 109 |
|
| 110 |
<dt><b>-corner-surround=</b><i>integer</i> |
| 111 |
|
| 112 |
<dd>Consider the specified number of pixels on either side of a |
| 113 |
point when determining if that point is a corner. Default is 4. |
| 114 |
|
| 115 |
<dt><b>-corner-threshold=</b><i>angle</i> |
| 116 |
|
| 117 |
<dd>Consider any pixel which forms an angle with its predecessors and |
| 118 |
successors that is smaller than <i>angle</i> (in decimal floating |
| 119 |
point degrees) as a corner. Default is 100. |
| 120 |
|
| 121 |
<dt><b>-error-threshold=</b><i>float</i> |
| 122 |
|
| 123 |
<dd>Subdivide fitted curves that are offset by a number of pixels |
| 124 |
exceeding the specified number. Default is 2.0. |
| 125 |
|
| 126 |
<dt><b>-filter-iterations=</b><i>integer</i> |
| 127 |
|
| 128 |
<dd>Smooth the curve the specified number of times prior to fitting |
| 129 |
Default is 4. |
| 130 |
|
| 131 |
<dt><b>-line-reversion-threshold=</b><i>float</i> |
| 132 |
|
| 133 |
<dd>When a spline is closer to a straight line than the specified real |
| 134 |
number weighted by the square of the curve length, maintain it as a |
| 135 |
straight line, even if it is a list with curves. |
| 136 |
|
| 137 |
<p>Default is .01. |
| 138 |
|
| 139 |
<dt><b>-line-threshold=</b><i>float</i> |
| 140 |
|
| 141 |
<dd>If a spline does not deviate from the straight line defined by its |
| 142 |
endpoints by more than the specified number of pixels, then treat it |
| 143 |
as a straight line. |
| 144 |
|
| 145 |
<p>Default is 1. |
| 146 |
|
| 147 |
<dt><b>-log</b> |
| 148 |
|
| 149 |
<dd>Create a log of the curve tracing process (suitable for |
| 150 |
debugging). Put it in the file named <i>inputfile</i><b>.log</b> in |
| 151 |
the current directory, where <i>inputfile</i> is the root of the input |
| 152 |
file name, or "pamtosvg" if the input is from Standard Input |
| 153 |
or a file with a weird name. |
| 154 |
|
| 155 |
<dt><b>-preserve-width</b> |
| 156 |
|
| 157 |
<dd>Preserve line width prior to thinning. Meaningful only with |
| 158 |
<b>-centerline</b>. |
| 159 |
|
| 160 |
<dt><b>remove-adjacent-corners</b> |
| 161 |
|
| 162 |
<dd>Remove adjacent corners. |
| 163 |
|
| 164 |
<dt><b>-report-progress</b> |
| 165 |
|
| 166 |
<dd>Report the progress of the tracing to Standard Error as it happens. |
| 167 |
|
| 168 |
<dt><b>-tangent-surround</b> |
| 169 |
|
| 170 |
<dd>Consider the specified number of points to either side of a point |
| 171 |
when computing the tangent at that point. Default is 3. |
| 172 |
|
| 173 |
<dt><b>-width-weight-factor</b> |
| 174 |
|
| 175 |
<dd>Weight factor for fitting the linewidth. |
| 176 |
|
| 177 |
</dl> |
| 178 |
|
| 179 |
<h2 id="applicationnotes">APPLICATION NOTES</h2> |
| 180 |
|
| 181 |
<p>A convenient way to view an SVG document is with a web browser. Many |
| 182 |
understand a file whose name ends in ".svg" to be an SVG |
| 183 |
image and can render it. |
| 184 |
|
| 185 |
|
| 186 |
<h2 id="seealso">SEE ALSO</h2> |
| 187 |
|
| 188 |
<b><a href="pnmquant.html">pnmquant</a></b>, |
| 189 |
<b><a href="pbmclean.html">pbmclean</a></b>, |
| 190 |
<a href="pnm.html">pnm</a>, |
| 191 |
<a href="http://autotrace.sourceforge.net">Autotrace</a> |
| 192 |
|
| 193 |
<h2 id="history">HISTORY</h2> |
| 194 |
|
| 195 |
<p><b>pamtosvg</b> was added to Netpbm in Version 10.33 (March 2006). |
| 196 |
|
| 197 |
<p>The core of <b>pamtosvg</b> -- the curve tracing logic -- was taken |
| 198 |
nearly unmodified from Martin Weber's Autotrace program. That program |
| 199 |
duplicates a lot of Netpbm function, so <b>pamtosvg</b> is a much leaner |
| 200 |
program. |
| 201 |
|
| 202 |
<p>Bryan Henderson created <b>pamtosvg</b>, basically just by adapting |
| 203 |
Autotrace to Netpbm. |
| 204 |
|
| 205 |
<p>Autotrace was first released in 2000 and updates were released |
| 206 |
through 2002. A number of people wrote the code in it, but Masatake |
| 207 |
Yamato and Martin Weber appear to be the principal creators of it. |
| 208 |
|
| 209 |
<p>As of June 2006, there was a <a |
| 210 |
href="http://autotrace.sourceforge.net">Sourceforge project</a> for it. |
| 211 |
|
| 212 |
<hr> |
| 213 |
<h2 id="index">Table Of Contents</h2> |
| 214 |
<ul> |
| 215 |
<li><a href="#synopsis">SYNOPSIS</a> |
| 216 |
<li><a href="#description">DESCRIPTION</a> |
| 217 |
<li><a href="#options">OPTIONS</a> |
| 218 |
<li><a href="#applicationnotes">APPLICATION NOTES</a> |
| 219 |
<li><a href="#seealso">SEE ALSO</a> |
| 220 |
<li><a href="#history">HISTORY</a> |
| 221 |
</ul> |
| 222 |
</body> |
| 223 |
</html> |