一、Potrace是什么

Potrace官网:https://potrace.sourceforge.net/

1.1 Description 描述

Potrace(TM) is a tool for tracing a bitmap, which means, transforming a bitmap into a smooth, scalable image. The input is a bitmap (PBM, PGM, PPM, or BMP format), and the output is one of several vector file formats. A typical use is to create SVG or PDF files from scanned data, such as company or university logos, handwritten notes, etc. The resulting image is not "jaggy" like a bitmap, but smooth. It can then be rendered at any resolution.

Potrace 是一款强大的工具,专门用于将位图转换为平滑、可缩放的矢量图形。无论是公司或大学的扫描标志,还是手写笔记,Potrace 都能将这些位图文件转换为高质量的矢量格式,如 SVG、PDF、EPS 等。转换后的图像不仅边缘平滑,还能在任何分辨率下渲染,避免了传统位图的锯齿效应。

Potrace can currently produce the following output formats: SVG, PDF, EPS, PostScript, DXF, GeoJSON, PGM (for easy antialiasing of pixel-based images), Gimppath, and XFig. Additional backends might be added in the future.
Potrace 目前可以生成以下输出格式:SVG、PDF、EPS、PostScript、DXF、GeoJSON、PGM(用于轻松对基于像素的图像进行抗锯齿)、Gimppath 和 XFig。将来可能会添加其他后端。

Mkbitmap is a program distributed with Potrace which can be used to pre-process the input for better tracing behavior on greyscale and color images.
Mkbitmap 是与 Potrace 一起分发的程序,可用于预处理输入,以便在灰度和彩色图像上实现更好的跟踪行为。

二、Potrace下载与安装

官网下载:https://potrace.sourceforge.net/
https://potrace.sourceforge.net/download/1.16/potrace-1.16.win64.zip
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

三、用法详解

Man page for potrace(1) potrace(1) 的手册页
NAME 名字
potrace - transform bitmaps into vector graphics.
Potrace - 将位图转换为矢量图形。
SYNOPSIS 概要
potrace [options] [filename...]

potrace [选项] [文件名...]

DESCRIPTION 描述
potrace is a tool for tracing a bitmap, which means, transforming a bitmap into a smooth, scalable image. The input is a bitmap, which means, a pixel-based image composed of the two colors black and white only. The output is SVG, PDF, EPS, or one of a number of other vector formats. A typical use is to create vector graphics from scanned data, such as company or university logos, handwritten notes, etc. The resulting image is not "jaggy" like a bitmap, but smooth. It can then be rendered at any resolution.
Potrace 是一种用于描摹位图的工具,这意味着将位图转换为平滑、可缩放的图像。输入是位图,这意味着仅由黑色和白色两种颜色组成的基于像素的图像。输出为 SVG、PDF、EPS 或许多其他矢量格式之一。典型用途是从扫描的数据创建矢量图形,例如公司或大学徽标、手写笔记等。生成的图像不像位图那样“锯齿状”,而是平滑的。然后,可以以任何分辨率渲染它。

potrace can read bitmaps in the following formats: PBM, PGM, PPM (collectively known as PNM, see pnm(5)), as well as BMP (Windows and OS/2 bitmap formats). The input image should only use the two colors black and white. If other pixel values appear in the input, they will be converted to black and white using a simple threshold method.
potrace 可以读取以下格式的位图:PBM、PGM、PPM(统称为 PNM,参见 pnm(5))以及 BMP(Windows 和 OS/2 位图格式)。输入图像应仅使用黑色和白色两种颜色。如果输入中出现其他像素值,则将使用简单的阈值方法将其转换为黑白。

potrace can currently produce the following output formats: SVG, PDF, EPS, PostScript, DXF, GeoJSON, PGM, Gimppath, and XFig. Additional backends might be added in the future.
potrace 目前可以生成以下输出格式:SVG、PDF、EPS、PostScript、DXF、GeoJSON、PGM、Gimppath 和 XFig。将来可能会添加其他后端。

OPTIONS 选项
The following options are supported. Dimensions (arguments of type dim) can have optional units, e.g. 6.5in, 15cm, 100pt. The default unit is inches (or centimeters, if this was configured at compile time, see COMPILE TIME CONFIGURATION below). For pixel-based output formats such as PGM, DXF, GeoJSON, and Gimppath, the default unit is pixels.
支持以下选项。维度(类型 Dim) 可以有可选单位,例如 6.5 英寸、15 厘米、100 磅。默认单位为英寸(或厘米,如果在编译时配置,请参阅下面的 COMPILE TIME CONFIGURATION)。对于基于像素的输出格式(如 PGM、DXF、GeoJSON 和 Gimppath),默认单位为像素。

General options: 常规选项:


-h, --help -h, --help
print help message and exit.
打印 Help Message 并退出。
-v, --version -v, --版本
print version info and exit. This also shows the defaults that were compiled into this version of potrace.
打印版本信息并退出。这还显示了编译到此版本的 potrace 中的默认值。
-l, --license -l, --license
print license info and exit.
打印许可证信息并退出。
Input/output options: 输入/输出选项:


filename 文件名
Each file can hold an input image, or multiple concatenated input images. If filename arguments are given, then potrace will by default create one output file for each input filename given. The name of the output file is obtained from the input filename by changing its suffix according to the chosen backend. If changing the suffix is impossible because the names of the input and output files would be identical, then the output filename is created by adding the "-out" suffix to the name of the input file. If no filename arguments are given, then potrace acts as a filter, reading from standard input and writing to standard output. A filename of "-" may be given to specify reading from standard input.
每个文件可以包含一个输入图像,也可以包含多个串联的输入图像。如果给出了 filename 参数,则 potrace 将默认 为每个给定的 input filename 创建一个输出文件。的名称 output file 是通过更改其后缀从 input filename 获取的 根据所选后端。如果无法更改后缀 因为输入和输出文件的名称相同, 然后,通过将 “-out” 后缀添加到 输入文件的名称。如果未给出 filename 参数,则 Potrace 充当过滤器,从标准输入读取并写入标准输出。可以给出文件名 “-” 来指定从标准输入中读取。
-o filename, --output filename
-o 文件名, --输出文件名
write output to this file. All output is directed to the specified file. If this option is used, then multiple input filenames are only allowed for multi-page backends (see BACKEND TYPES below). In this case, each input file may contain one or more bitmaps, and all the bitmaps from all the input files are processed and the output concatenated into a single file. A filename of "-" may be given to specify writing to standard output.
write output 到此文件。所有输出都定向到指定的文件。如果使用此选项,则仅允许多页后端使用多个输入文件名(请参阅下面的 BACKEND TYPES)。在这种情况下,每个输入文件可能包含一个或多个位图,并且所有输入文件中的所有位图都将被处理,并将输出连接到一个文件中。可以给出文件名 “-” 来指定写入标准输出。
--
End of options. Any remaining arguments are interpreted as filenames. This also disables filter mode, even if no filenames are given. This is useful for shell scripts, because potrace -- $FILENAMES will behave correctly even for an empty list of filenames. However, -- with an empty list of filenames is not permitted in conjunction with the -o option, because this would generate a document of zero pages, which none of the backends permit.
选项结束。任何剩余的参数都将被解释为 filenames。这也会禁用 filter 模式,即使没有给出文件名。这对于 shell 脚本很有用,因为 potrace -- $FILENAMES 即使对于空的文件名列表,也可以正常工作。然而 -- 不允许将空文件名列表与 -o 选项结合使用,因为这会生成零页的文档,而任何后端都不允许。
Backend selection: 后端选择:

For general information, see also BACKEND TYPES below.
有关一般信息,另请参阅下面的 BACKEND TYPES。

-b name, --backend name
-b 名称, --后端名称
Select backend by name, where name is one of eps, postscript, ps, pdf, pdfpage, svg, dxf, geojson, pgm, gimppath, xfig. Backend names can be abbreviated by a prefix as long as it is unambiguous. Backend names are case insensitive.
按名称选择后端,其中 name 是 eps、postscript、ps、pdf、pdfpage、svg、dxf、geojson、pgm、gimppath、xfig 之一。后端名称可以用前缀缩写,只要它是明确的。后端名称不区分大小写。
-s, --svg, -b svg, --backend svg
-s, --svg, -b svg, --backend svg
SVG backend. The output is a Scalable Vector Graphics (SVG) file. This is a single-page, variable-sized, dimension-based backend. Note that unless the -r option is given, the resolution of the input bitmap is assumed to be 72dpi.
SVG 后端。输出是可缩放矢量图形 (SVG) 文件。这是一个单页、大小可变、基于维度的后端。请注意,除非给定 -r 选项,否则将假定输入位图的分辨率为 72dpi。
-b pdf, --backend pdf -b pdf, --后端 pdf
PDF backend. The output is a file in the Portable Document Format. If the input consists of multiple bitmaps, they are each rendered on a separate page. This is a multi-page, variable-sized, dimension-based backend.
PDF 后端。输出是 Portable Document Format (可移植文档格式) 的文件。如果输入由多个位图组成,则每个位图都呈现在单独的页面上。这是一个多页面、可变大小、基于维度的后端。
-b pdfpage, --backend pdfpage
-b pdfpage, --backend pdfpage
The PDFPage backend is like the PDF backend, except that it is fixed-size like the PostScript backend.
PDFPage 后端与 PDF 后端类似,不同之处在于它与 PostScript 后端一样是固定大小的。
-e, --eps, -b eps, --backend eps
-e, --eps, -b eps, --backend eps
EPS backend (default). The output is an encapsulated PostScript file. This is a single-page, variable-sized, dimension-based backend.
EPS 后端 (默认)。输出是一个封装的 PostScript 文件。这是一个单页、大小可变、基于维度的后端。
-p, --postscript, -b ps, --backend ps
-p, --postscript, -b ps, --backend ps
PostScript backend. The output is a PostScript file. This is a multi-page, fixed-size, dimension-based backend. If the input consists of multiple bitmaps, they are each rendered on a separate page.
PostScript 后端。输出是一个 PostScript 文件。这是一个多页、固定大小、基于维度的后端。如果输入由多个位图组成,则每个位图都呈现在单独的页面上。
-b dxf, --backend dxf -b dxf, --backend dxf
DXF backend. The output is a file in the Drawing Interchange Format (DXF). In this backend, all Bezier curves are approximated by piecewise circular arcs; this is suitable for processing in CAD software or for machining applications using CNC tools. This is a single-page, variable-sized, pixel-based backend. The -u option has no effect for this backend.
DXF 后端。输出是工程图交换格式 (DXF) 的文件。在此后端中,所有 Bezier 曲线都由分段圆弧近似;这适用于在 CAD 软件中加工或使用 CNC 工具的加工应用。这是一个单页、可变大小、基于像素的后端。-u 选项对此后端没有影响。
-b geojson, --backend geojson
-b geojson, --后端 geojson
GeoJSON backend. The output is a file in the format used by some applications processing geographical data. In this backend, all Bezier curves are approximated by 8 straight line segments. This is a single-page, variable-sized, pixel-based backend. The -u option has no effect for this backend.
GeoJSON 后端。输出是某些处理地理数据的应用程序使用的格式的文件。在此后端中,所有贝塞尔曲线都由 8 条直线段近似。这是一个单页、可变大小、基于像素的后端。-u 选项对此后端没有影响。
-g, --pgm, -b pgm, --backend pgm
-g, --pgm, -b pgm, --backend pgm
PGM backend. The output is a portable greymap (PGM) file. It is a convenient backend for antialiasing a bitmap image. This is a multi-page, variable-sized, pixel-based backend. If the input consists of more than one image, the images are concatenated in the output.
PGM 后端。输出是一个可移植灰度图 (PGM) 文件。它是位图图像抗锯齿的便捷后端。这是一个多页面、可变大小、基于像素的后端。如果输入包含多个图像,则图像将在输出中串联。
-b gimppath, --backend gimppath
-b gimppath, --backend gimppath
Gimppath backend. This backend produces output suitable to be imported as a path by the GNU Image Manipulation Program (Gimp) (in the Layers, Channels & Paths dialog, select Paths, then right-click and select Import Path). The output is actually an SVG file. The differences to the SVG backend are: the --opaque option has no effect, the --flat option is always on, and the dimensions are pixel-based. This is a single-page, variable-sized, pixel-based backend.
Gimppath 后端。此后端产生的输出适合通过GNU图像处理程序(Gimp)作为路径导入(在图层、通道和路径对话框中,选择路径,然后右键单击并选择导入路径)。输出实际上是一个 SVG 文件。与 SVG 后端的区别在于:--opaque 选项没有效果, --flat 选项始终处于打开状态,并且尺寸是基于像素的。这是一个单页、可变大小、基于像素的后端。
-b xfig, --backend xfig -b xfig, --backend xfig
XFig backend. This is a single-page, fixed-size, dimension-based backend. The output is a file in the XFig format. Note that XFig uses X-splines instead of Bezier curves, thus it is not possible to translate the output of potrace into the XFig format with absolute accuracy. This backend does a reasonable approximation using two control points for each Bezier curve segment. The -u option has no effect for this backend, because control points are always rounded to the nearest 1/1200 of an inch in XFig. Curve optimization is disabled. Implies --opaque.
XFig 后端。这是一个单页、固定大小、基于维度的后端。输出是 XFig 格式的文件。请注意,XFig 使用 X 样条曲线而不是贝塞尔曲线,因此无法绝对准确地将 potrace 的输出转换为 XFig 格式。此后端对每个贝塞尔曲线段使用两个控制点进行合理的近似。-u 选项对此后端没有影响,因为在 XFig 中,控制点总是四舍五入到最接近的 1/1200 英寸。曲线优化已禁用。暗示 --opaque。
Algorithm options: 算法选项:

For more detailed information on these options, see TECHNICAL DOCUMENTATION below.
有关这些选项的更多详细信息,请参阅下面的 技术文档 。

-z policy, --turnpolicy policy
-z 策略、--turnpolicy 策略
specify how to resolve ambiguities in path decomposition. Must be one of black, white, right, left, minority, majority, or random. Default is minority. Turn policies can be abbreviated by an unambiguous prefix, e.g., one can specify min instead of minority.
指定如何解决路径分解中的歧义。必须是黑色、白色、右侧、左侧、少数、多数或随机之一。默认为 minority。轮次策略可以用明确的前缀缩写,例如,可以指定 min 而不是 minority。
-t n, --turdsize n
-t n, --turdsize n
suppress speckles of up to this many pixels.
抑制最多这么多像素的斑点。
-a n, --alphamax n
-a n, --alphamax n
set the corner threshold parameter. The default value is 1. The smaller this value, the more sharp corners will be produced. If this parameter is 0, then no smoothing will be performed and the output is a polygon. If this parameter is greater than 4/3, then all corners are suppressed and the output is completely smooth.
设置 corner threshold 参数。默认值为 1。该值越小,产生的尖角就越多。如果此参数为 0,则不会执行平滑,输出为多边形。如果此参数大于 4/3,则所有角都将被抑制,输出完全平滑。
-n, --longcurve -n, --longcurve
turn off curve optimization. Normally potrace tries to join adjacent Bezier curve segments when this is possible. This option disables this behavior, resulting in a larger file size.
关闭 Curve Optimization(曲线优化)。通常, potrace 会尽可能尝试连接相邻的 Bezier 曲线段。此选项将禁用此行为,从而导致文件大小变大。
-O n, --opttolerance n
-O n, --opttolerance n
set the curve optimization tolerance. The default value is 0.2. Larger values allow more consecutive Bezier curve segments to be joined together in a single segment, at the expense of accuracy.
设置 Curve Optimization Tolerance。默认值为 0.2。较大的值允许在单个段中将更多连续的 Bezier 曲线段连接在一起,但会降低准确性。
-u n, --unit n
-u n, --单位 n
set output quantization. Coordinates in the output are rounded to 1/unit pixels. The default of 10 usually gives good results. For some of the debug modes, a value of 100 gives more accurate output. This option has no effect for the XFig backend, which always rasterizes to 1/1200 inch, or for the DXF backend. For the GeoJSON backend, this option is only a hint; the actual rounding may be more, but not less, accurate than specified.
设置 Output Quantization。输出中的坐标四舍五入为 1/单位像素。默认值 10 通常会产生良好的结果。对于某些调试模式,值 100 可提供更准确的输出。此选项对 XFig 后端(始终栅格化为 1/1200 英寸)或 DXF 后端没有影响。对于 GeoJSON 后端,此选项只是一个提示;实际舍入的精度可能高于指定值,但不会低于指定值。
-d n, --debug n
-d n, --debug n
produce debugging output of type n. This has different effects for different backends. For the PostScript/EPS backends, the values n=1,2,3 illustrate the intermediate stages of the potrace algorithm.
生成类型 n 的调试输出。这对不同的后端有不同的影响。对于 PostScript/EPS 后端,值 n=1,2,3 说明了 potrace 算法的中间阶段。
Scaling and placement options:
缩放和放置选项:


-P format, --pagesize format
-P 格式, --pagesize 格式
for fixed-size backends, set page size. The following formats can be specified: A4, A3, A5, B5, Letter, Legal, Tabloid, Statement, Executive, Folio, Quarto, 10x14. Format names are case insensitive. Also, an argument of the form dimxdim is accepted to specify arbitrary dimensions. The default page size is Letter (or A4, if this was configured at compile time, see COMPILE TIME CONFIGURATION below). Page format names can be abbreviated by a prefix as long as it is unambiguous. This option has no effect for variable-sized backends.
对于固定大小的后端,请设置页面大小。可以指定以下格式:A4、A3、A5、B5、Letter、Legal、Tabloid、Statement、Executive、Folio、Quarto、10x14。格式名称不区分大小写。此外,接受 dimxdim 形式的参数来指定任意维度。默认页面大小为 Letter(或 A4,如果在编译时配置,请参阅下面的 COMPILE TIME CONFIGURATION)。页面格式名称可以用前缀缩写,只要它是明确的。此选项对可变大小的后端没有影响。
-W dim, --width dim
-W dim, --width dim
set the width of output image (before any rotation and margins). If only one of width and height is specified, the other is adjusted accordingly so that the aspect ratio is preserved.
设置输出图像的宽度(在任何旋转和边距之前)。如果只指定了 width 和 height 中的一个,则会相应地调整另一个,以便保留纵横比。
-H dim, --height dim
-H dim, --height dim
set the height of output image. See -W for details.
设置输出图像的高度。有关详细信息,请参阅 -W-r n[xn], --resolution n[xn]
-r n[xn], --分辨率 n[xn]
for dimension-based backends, set the resolution (in dpi). One inch in the output image corresponds to this many pixels in the input. Note that a larger value results in a smaller output image. It is possible to specify separate resolutions in the x and y directions by giving an argument of the form nxn. For variable-sized backends, the default resolution is 72dpi. For fixed-size backends, there is no default resolution; the image is by default scaled to fit on the page. This option has no effect for pixel-based backends. If -W or -H are specified, they take precedence.
对于基于维度的后端,设置 分辨率(以 dpi 为单位)。输出图像中的 1 英寸对应于输入中的这么多像素。请注意,值越大,输出图像越小。可以通过给出 nxn 形式的参数来指定 x 和 y 方向上的单独分辨率。对于可变大小的后端,默认分辨率为 72dpi。对于固定大小的后端,没有默认分辨率;默认情况下,图像会缩放以适合页面。此选项对基于像素的后端没有影响。如果指定了 -W 或 -H,则它们优先。
-x n[xn], --scale n[xn]
-x n[xn]--scale n[xn]
for pixel-based backends, set the scaling factor. A value greater than 1 enlarges the output, a value between 0 and 1 makes the output smaller. The default is 1. It is possible to specify separate scaling factors for the x and y directions by giving an argument of the form nxn. This option has no effect for dimension-based backends. If -W or -H are specified, they take precedence.
对于基于像素的后端,请设置 Scaling factor(缩放因子)。大于 1 放大输出,0 到 1 之间的值表示输出 较小。默认值为 1。可以指定单独的缩放 x 和 y 方向的因子,给出以下形式的参数 nxn.此选项对基于维度的后端没有影响。如果指定了 -W 或 -H,则它们优先。
-S n, --stretch n
-S n, --拉伸 n
set the aspect ratio. A value greater than 1 means the image will be stretched in the y direction. A value between 0 and 1 means the image will be compressed in the y direction.
设置 纵横比。大于 1 的值表示图像将沿 y 方向拉伸。介于 01 之间的值表示图像将在 y 方向上压缩。
-A angle, --rotate angle
-A 角度,--旋转角度
set the rotation angle (in degrees). The output will be rotated counterclockwise by this angle. This is useful for compensating for images that were scanned not quite upright.
设置 Rotation angle (旋转角度)(以度为单位)。输出将逆时针旋转此角度。这对于补偿扫描不完全直立的图像非常有用。
-M dim, --margin dim
-M 暗淡, --margin 暗淡
set all four margins. The effect and default value of this option depend on the backend. For variable-sized backends, the margins will simply be added around the output image (or subtracted, in case of negative margins). The default margin for these backends is 0. For fixed-size backends, the margin settings can be used to control the placement of the image on the page. If only one of the left and right margin is given, the image will be placed this distance from the respective edge of the page, and similarly for top and bottom. If margins are given on opposite sides, the image is scaled to fit between these margins, unless the scaling is already determined explicitly by one or more of the -W, -H, -r, or -x options. By default, fixed-size backends use a non-zero margin whose width depends on the page size.
设置所有四个边距。此选项的效果和默认值取决于后端。对于可变大小的后端,只需在输出图像周围添加外边距(或在负边距的情况下减去外边距)。这些后端的默认边距为 0。对于固定大小的后端,边距设置可用于控制图像在页面上的位置。如果只给出了左右边距中的一个,则图像将放置在距页面相应边缘此距离的位置,顶部和底部也是如此。如果在相对的一侧给出边距,则图像将缩放以适合这些边距之间,除非缩放已由 -W、-H、-r 或 -x 选项。默认情况下,固定大小的后端使用非零边距,其宽度取决于页面大小。
-L dim, --leftmargin dim
-L dim, --leftmargin dim
set the left margin. See -M for details.
设置左边距。有关详细信息,请参阅 -M-R dim, --rightmargin dim
-R 暗淡, --右边距暗淡
set the right margin. See -M for details.
设置右边距。有关详细信息,请参阅 -M-T dim, --topmargin dim
-T dim, --topmargin dim
set the top margin. See -M for details.
设置上边距。有关详细信息,请参阅 -M-B dim, --bottommargin dim
-B 暗淡,--下边距暗淡
set the bottom margin. See -M for details.
设置下边距。有关详细信息,请参阅 -M--tight --紧
remove whitespace around the image before scaling and margins are applied. If this option is given, calculations of the width, height, and margins are based on the actual vector outline, rather than on the outer dimensions of the input pixmap, which is the default. In particular, the --tight option can be used to remove any existing margins from the input image. See the file placement.pdf for a more detailed illustration.
在应用缩放和边距之前删除图像周围的空白区域。如果给定此选项,则宽度、高度和边距的计算基于实际的矢量轮廓,而不是基于输入像素图的外部尺寸,这是默认值。特别是,--tight 选项可用于从输入图像中删除任何现有边距。有关更详细的说明,请参阅文件placement.pdf。
Color options: 颜色选项:

These options are only supported by certain backends. The DXF and GeoJSON backends do not support color.
这些选项仅受某些后端支持。DXF 和 GeoJSON 后端不支持颜色。

-C #rrggbb, --color #rrggbb
-C #rrggbb, --color #rrggbb
set the foreground color of the output image. The default is black.
设置输出图像的前景色。默认值为 black。
--fillcolor #rrggbb
set the fill color of the output image, i.e., the color of the "white" parts that are enclosed by "black" parts. The default is to leave these parts transparent. Implies --opaque. Please note that this option sets the background color; to set the foreground color, use --color instead.
设置输出图像的填充颜色,即 “white” 部分与 “Black” 部分包围的颜色。默认设置是使这些部分保持透明。暗示 --opaque。请注意,此选项设置背景颜色;要设置前景色,请改用 --color。
--opaque --不透明
fill in the white parts of the image opaquely, instead of leaving them transparent. This only applies to interior white parts, i.e., those that are enclosed inside a black outline. Opaqueness is always in effect for the XFig backend.
以不透明的方式填充图像的白色部分,而不是使它们保持透明。这仅适用于内部白色零件,即封闭在黑色轮廓内的零件。不透明性始终对 XFig 后端有效。
SVG options: SVG 选项:


--group --群
for SVG output, try to group related paths together. Each path is grouped together with all paths that are contained inside it, so that they can be moved around as a unit with an SVG editor. This makes coloring individual components slightly more cumbersome, and thus it is not the default.
对于 SVG 输出,请尝试将相关路径组合在一起。每个路径都与其中包含的所有路径组合在一起,以便可以使用 SVG 编辑器将它们作为一个单元进行移动。这使得为单个组件着色稍微麻烦一些,因此它不是默认设置。
--flat --平
for SVG output, put the entire image into a single path. This makes it impossible to color the components individually, and thus it is not the default. But the resulting SVG file can be more easily imported by some applications such as Gimp. In fact, the Gimppath backend is a variation of the SVG backend with the --flat option and pixel-based scaling. The --flat option has no effect if --opaque has been selected.
对于 SVG 输出,请将整个图像放入单个路径中。这使得无法单独为组件着色,因此它不是默认设置。但是生成的 SVG 文件可以更容易地被某些应用程序(如 Gimp)导入。事实上,Gimppath 后端是 SVG 后端的变体,具有 --flat 选项和基于像素的缩放。如果选择了 --opaque,则 --flat 选项不起作用。
PostScript/EPS/PDF options:
PostScript/EPS/PDF 选项:


-c, --cleartext -c, --明文
do not compress the output. This option disables the use of compression filters in the PostScript and PDF output. In the PostScript backend, if -c and -q are used together, the resulting output can be easily read by other programs or even by humans.
不要压缩输出。此选项将禁用在 PostScript 和 PDF 输出中使用压缩滤镜。在 PostScript 后端中,如果 -c-q 一起使用,则生成的输出可以很容易地被其他程序甚至人类读取。
-2, --level2 -2, --level2
use PostScript level 2 compression (default). The resulting file size is ca. 40% smaller than if the -c option is used.
使用 PostScript 2 级压缩(默认)。生成的文件大小比使用 -c 选项时小约 40%。
-3, --level3 -3, --level3
use PostScript level 3 compression, if available. This gives slightly smaller files than using -2, but the resulting files may not print on older PostScript level 2 printers. If support for PostScript level 3 compression has been disabled at compile time, a warning message is printed and level 2 compression is used instead.
使用 PostScript 级别 3 压缩(如果可用)。与使用 -2 相比,这生成的文件略小,但生成的文件可能无法在较旧的 PostScript 2 级打印机上打印。如果在编译时禁用了对 PostScript 3 级压缩的支持,则会打印一条警告消息,并改用 2 级压缩。
-q, --longcoding -q, --long编码
turn off optimized numerical coding in PostScript output. Normally, potrace uses a very compact numerical format to represent Bezier curves in PostScript, taking advantage of existing redundancy in the curve parameters. This option disables this behavior, resulting in longer, but more readable output (particularly if the -c option is also used).
关闭 PostScript 输出中的优化数字编码。通常 potrace 使用非常紧凑的数字格式在 PostScript 中表示贝塞尔曲线,利用曲线参数中的现有冗余。此选项将禁用此行为,从而产生更长但更具可读性的输出(尤其是在同时使用 -c 选项时)。
PGM options: PGM 选项:


-G n, --gamma n
-G n, --伽马 n
set the gamma value for anti-aliasing (default is 2.2). Most computer displays do not render shades of grey linearly, i.e., a grey value of 0.5 is not displayed as being exactly half-way between black and white. The gamma parameter corrects for this, and therefore leads to nicer looking output. The default value of 2.2 is appropriate for most normal CRT displays.
设置 Anti-Aliasing 的 Gamma 值(默认值为 2.2)。大多数计算机显示器不会线性呈现灰色阴影,即,灰色值 0.5 不会显示为正好介于黑色和白色之间。gamma 参数对此进行了校正,因此可以产生更漂亮的输出。默认值 2.2 适用于大多数普通 CRT 显示器。
Frontend options: 前端选项:


-k n, --blacklevel n
-k n, --blacklevel n
set the threshold level for converting input images to bitmaps. The potrace algorithm expects a bitmap, thus all pixels of the input images are converted to black or white before processing begins. Pixels whose brightness is less than n are converted to black, all other pixels to white. Here n is a number between 0 and 1. One case is treated specially: if the input is in an indexed color format with exactly 2 colors, then the blacklevel is ignored and the darker of the two colors is mapped to black.
设置用于将输入图像转换为位图的阈值级别。这 PoTrace 算法需要一个位图,因此在处理开始之前,输入图像的所有像素都会转换为黑色或白色。亮度小于 n 的像素将转换为黑色,所有其他像素将转换为白色。这里 n 是介于 01. 一种情况被特殊处理:如果输入是索引颜色 格式正好为 2 种颜色,则忽略 blacklevel 和 两种颜色中较暗的颜色将映射到黑色。
Note: the method used by potrace for converting greymaps to bitmaps is very crude; much better results can be obtained if a separate program, such as mkbitmap(1), is used for this purpose. In particular, mkbitmap(1), which is distributed with potrace, has the ability to scale and interpolate the image before thresholding, which results in much better preservation of detail.
注意:potrace 用于将灰图转换为位图的方法非常粗糙;如果使用单独的程序(如 mkbitmap(1))来实现此目的,则可以获得更好的结果。特别是 mkbitmap(1),它与 PoTrace 能够在阈值之前对图像进行缩放和插值,从而更好地保留细节。

-i, --invert -i, --invert
invert the input bitmap before processing.
在处理之前反转输入位图。
Progress bar options: 进度条选项:


--progress --进展
display a progress bar for each bitmap that is processed. This is useful for interactive use. The default behavior is not to show any progress information.
显示每个已处理位图的进度条。这对于交互式使用非常有用。默认行为是不显示任何进度信息。
--tty mode --tty 模式
set the terminal mode for progress bar rendering. Possible values are "vt100", which requires a vt100-compatible terminal, and "dumb", which uses only ASCII characters. The default is system dependent.
设置进度条渲染的终端模式。可能的值为 “vt100” (需要与 vt100 兼容的终端)和 “dumb” (仅使用 ASCII 字符)。默认值取决于系统。
BACKEND TYPES 后端类型
Backends can be classified in several ways, which affects the available command line options and their behavior:
后端可以通过多种方式进行分类,这会影响 可用的命令行选项及其行为:
Fixed-size or variable-sized:
固定大小或可变大小:
For fixed-size backends, the size of the page is always the same (for example Letter or A4, as specified at compile time or by the -P option). By default, the image will be centered and scaled to fit the page size. For variable-size backends, the size of the page follows the size of the image. Currently the PostScript (PS), PDFPage, and XFig backends are fixed-size, and the remaining backends are variable-size.
对于固定大小的后端,页面的大小始终相同(例如,Letter 或 A4,在编译时或通过 -P 选项指定)。默认情况下,图像将居中并缩放以适应页面大小。对于可变大小的后端,页面的大小遵循图像的大小。目前,PostScript (PS)、PDFPage 和 XFig 后端是固定大小的,其余后端是可变大小的。
Dimension-based or pixel-based:
基于维度或基于像素:
In dimension-based backends, distances are measured in physical units such as inches or centimeters. In pixel-based backends, distances are measured in pixel units. The -r option only works for dimension-based backends, and the -x option only works for pixel-based backends. Currently, the DXF, PGM, Gimppath, and GeoJSON backends are pixel-based, and the remaining backends are dimension-based. Currently, all pixel-based backends are variable-sized.
在基于维度的后端中,距离以物理单位(如英寸或厘米)进行测量。在基于像素的后端中,距离以像素单位测量。-r 选项仅适用于基于维度的后端,而 -x 选项仅适用于基于像素的后端。目前,DXF、PGM、Gimppath 和 GeoJSON 后端是基于像素的,其余后端是基于维度的。目前,所有基于像素的后端都是可变大小的。
Single-page or multi-page:
单页或多页:
Single-page backends can only accept a single image. Multi-page backends can accept multiple images, typically one per page of output. Currently, the PostScript (PS), PDF, PDFPage, and PGM backends are multi-page, and the remaining backends are single-page. Note that multiple input images can be read in two ways: from multiple input files (with the -o option), or from a single input file that holds several concatenated images.
单页后端只能接受单个图像。多页后端可以 接受多个图像,通常每页输出一个图像。目前, PostScript (PS)、PDF、PDFPage 和 PGM 后端是多页的,并且 其余后端是单页的。请注意,多个输入 可以通过两种方式读取图像:从多个输入文件中读取图像(使用 -o 选项),或者从包含多个串联图像的单个输入文件中获取。
COMPILE TIME CONFIGURATION
编译时配置
Certain aspects of the behavior of potrace can be configured at compile time by passing the following options to the ./configure script.
potrace 行为的某些方面可以在编译时通过向 ./configure 脚本传递以下选项来配置。

--disable-zlib --禁用 zlib
compile potrace without the zlib compression library. This means PostScript level 3 compression will not be available.
在没有 zlib 压缩库的情况下编译 PoTrace。这意味着 PostScript 级别 3 压缩将不可用。
--enable-metric
compile potrace with centimeters as the default unit instead of inches.
编译 Potrace 时,以厘米作为默认单位,而不是英寸。
--enable-a4
compile potrace with A4 as the default page size.
编译 potrace 时,以 A4 作为默认页面大小。
EXIT STATUS 退出状态
The exit status is 0 on successful completion, 1 if the command line was invalid, and 2 on any other error.
成功完成时退出状态为 0,如果命令行无效,则退出状态为 1,任何其他错误时退出状态为 2。

VERSION 版本
1.16

AUTHOR 作者
Peter Selinger  彼得·塞林格

Please see the file AUTHORS for a full list of other contributors.
请参阅文件 AUTHORS 以获取其他贡献者的完整列表。

TECHNICAL DOCUMENTATION 技术文档
For a detailed technical description of the potrace algorithm, see the file potrace.pdf, which is available from the potrace web site. For information on the Potrace library API, see potracelib.pdf.
有关 potrace 算法的详细技术说明,请参阅文件potrace.pdf,可从 potrace Web 站点获得。有关 Potrace 库 API 的信息,请参阅 potracelib.pdf。

WEB SITE AND SUPPORT 网站和支持
The latest version of potrace is available from http://potrace.sourceforge.net/. This site also contains a list of frequently asked questions, as well as information on how to obtain support.
最新版本的 potrace 可从 http://potrace.sourceforge.net/ 获得。此站点还包含常见问题列表,以及有关如何获得支持的信息。

SEE ALSO 另请参阅
mkbitmap(1)  mkbitmap(1)

COPYRIGHT 版权
Copyright (C) 2001-2019 Peter Selinger
版权所有 (C) 2001-2019 Peter Selinger

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
该程序是免费软件;您可以根据 Free Software Foundation 发布的 GNU 通用公共许可证的条款重新分发和/或修改它;许可证的第 2 版,或(根据您的选择)任何更高版本。

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
分发此程序是希望它有用,但没有任何保证;甚至没有对适销性或特定用途适用性的暗示保证。有关更多详细信息,请参阅 GNU 通用公共许可证。

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. See also http://www.gnu.org/.
您应该已经收到了 GNU 通用公共许可证的副本以及此程序;如果没有,请写信给 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA。另请参见 http://www.gnu.org/。
项目技术分析
Potrace 的核心功能是通过解析位图(支持 PBM、PGM、PPM 或 BMP 格式)并将其转换为多种矢量文件格式。它依赖于 zlib 库进行 PostScript 级别的压缩,这在大多数现代系统中已预安装。此外,Potrace 还提供了一个名为 mkbitmap 的预处理器,可以对灰度和彩色图像进行缩放和滤镜处理,进一步优化转换效果。

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐