Plan 9 from Bell Labs’s /usr/web/sources/contrib/pac/sys/doc/netpbm/ms/pamtosvg.ms

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.TL
Pamtosvg User Manual
.SH 1
pamtosvg
.LP
Updated: 23 April 2006
.br
Table Of Contents
.SH 2
NAME
.LP
pamtosvg - convert a Netpbm image to a SVG (Scalable Vector Graphics) image
.SH 2
SYNOPSIS
.LP
\fBpamtosvg\fR
[\fB-background-color=\fR\fIcolorname\fR]
[\fB-centerline\fR]
[\fB-corner-threshold=\fR\fIangle\fR]
[\fB-corner-always-threshold=\fR\fIangle\fR]
[\fB-corner-surround=\fR\fIinteger\fR]
[\fB-tangent-surround=\fR\fIinteger\fR]
[\fB-error-threshold=\fR\fIfloat\fR]
[\fB-filter-iterations=\fR\fIcount\fR]
[\fB-line-reversion-threshold=\fR\fIfloat\fR]
[\fB-line-threshold=\fR\fIfloat\fR]
[\fB-width-factor=\fR\fIfloat\fR]
[\fB-preserve-width\fR]
[\fB-remove-adjacent-corners\fR]
[\fB-log\fR]
[\fB-report-progress\fR]
[\fIpnmfile\fR]
.LP
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.
.SH 2
DESCRIPTION
.LP
.LP
This program is part of Netpbm.
.LP
\fBpamtosvg\fR 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.
.LP
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.
.LP
That means it is really an understatement to say that \fBpamtosvg\fR
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.
.LP
\fBpamtosvg\fR does the same kind of thing that StreamLine,
CorelTrace, and Autotrace do.  It is in fact derived from Autotrace.
.LP
SVG is a gigantic format, capable of amazing things.  \fBpamtosvg\fR
exploits only a morsel of it.  The SVG image produced by \fBpamtosvg\fR
consists of a single <svg> element, which has a "width"
attribute and a "height" attribute.  The value of that element
is composed of <path> elements.  That's it.
.LP
In the SVG output, distances are unitless, with one unit corresponding
to one pixel of the input.
.LP
So that \fBpamtosvg\fR will find simple curves in the image, you
may want to remove speckles from it with \fBpbmclean\fR and consolidate
multiple shades into single colors with \fBpnmquant\fR first.
.LP
For more information on SVG, see the Worldwide Web Consortium's
SVG web page.
.SH 2
OPTIONS
.LP
.RS
.IP "\fB-background-color=\fR\fIcolorname\fR"
Treat the specified color as the background color and ignore it.
.LP
If you don't specify this option, \fBpamtosvg\fR does not recognize
any background color.
.LP
Specify the color (\fIcolorname\fR) as described for the argument of the \fBppm_parsecolor()\fR
library routine.
.IP "\fB-centerline\fR"
Trace an object's centerline.
.LP
By default, \fBpamtosvg\fR traces an object's outline.
.IP "\fB-corner-always-threshold=\fR\fIangle\fR"
Consider any angle at a pixel which falls below angle \fIangle\fR
(in decimal floating point degrees) as a corner, even if it is
bordered by other corner pixels.  Default is 60 degrees.
.IP "\fB-corner-surround=\fR\fIinteger\fR"
Consider the specified number of pixels on either side of a
point when determining if that point is a corner.  Default is 4.
.IP "\fB-corner-threshold=\fR\fIangle\fR"
Consider any pixel which forms an angle with its predecessors and
successors that is smaller than \fIangle\fR (in decimal floating
point degrees) as a corner.  Default is 100.
.IP "\fB-error-threshold=\fR\fIfloat\fR"
Subdivide fitted curves that are offset by a number of pixels
exceeding the specified number.  Default is 2.0.
.IP "\fB-filter-iterations=\fR\fIinteger\fR"
Smooth the curve the specified number of times prior to fitting
Default is 4.
.IP "\fB-line-reversion-threshold=\fR\fIfloat\fR"
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.
.LP
Default is .01.
.IP "\fB-line-threshold=\fR\fIfloat\fR"
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.
.LP
Default is 1.
.IP "\fB-log\fR"
Send a detailed progress report to the file named
\fIinputfile\fR\fB.log\fR, where \fIinputfile\fR is the root of the
input file name, or "pamtosvg" if the input is from 
Standard Input or a file with a weird name.
.IP "\fB-preserve-width\fR"
Preserve line width prior to thinning.  Meaningful only with
\fB-centerline\fR.
.IP "\fBremove-adjacent-corners\fR"
Remove adjacent corners.
.IP "\fB-report-progress\fR"
Report the progress of the tracing to Standard Error as it happens.
.IP "\fB-tangent-surround\fR"
Consider the specified number of points to either side of a point
when computing the tangent at that point.  Default is 3.
.IP "\fB-width-factor\fR"
Weight factor for fitting the linewidth.
.RE
.SH 2
SEE ALSO
.LP
\fBpnmquant\fR,
\fBpbmclean\fR,
pnm,
Autotrace
.SH 2
HISTORY
.LP
.LP
\fBpamtosvg\fR was added to Netpbm in Version 10.33 (March 2006).
.LP
The core of \fBpamtosvg\fR -- the curve tracing logic -- was taken
nearly unmodified from Martin Weber's Autotrace program.  That program
duplicates a lot of Netpbm function, so \fBpamtosvg\fR is a much leaner
program.
.LP
Bryan Henderson created \fBpamtosvg\fR, basically just by adapting
Autotrace to Netpbm.
.LP
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.
.LP
As of June 2006, there was a Sourceforge project for it.
.br
\l'5i'
.SH 2
Table Of Contents
.LP
.IP \(bu
SYNOPSIS
.IP \(bu
DESCRIPTION
.IP \(bu
OPTIONS
.IP \(bu
SEE ALSO
.IP \(bu
HISTORY
.LP

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.