The Wayback Machine - https://web.archive.org/web/20090909215555/http://potrace.sourceforge.net:80/

Potrace

Transforming bitmaps into vector graphics


Contents

Description

Potrace(TM) is a utility 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 default output is an encapsulated PostScript file (EPS). A typical use is to create EPS 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 can currently produce the following output formats: EPS, PostScript, PDF, SVG (scalable vector graphics), Xfig, Gimppath, and PGM (for easy antialiasing). Additional backends might be added in the future.

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. See the mkbitmap examples page.

Example

Original image
Potrace output
More examples...

Mkbitmap examples...

Frequently asked questions

Trouble using Potrace? Here are the answers to some frequently asked questions.

News

For changes prior to version 1.6, see the file NEWS. For a more detailed list of changes, see the ChangeLog.

May 22, 2007: Updated XFig backend. The following patch to Potrace 1.8 improves the XFig output by adding a depth setting to the spline components. This prevents them from floating to the background when editing. Thanks to Rafael Laboissiere for suggesting this.

April 9, 2007: Release 1.8. This release contains minor bugfixes and portability improvements. Rotation is now implemented in the PDF backend.

March 6, 2005: Release 1.7. This is a bugfix release. A bug in the progress bar code, which caused arithmetic exceptions on some 64-bit architectures, has been fixed.

February 27, 2005: Release 1.6. This release contains an algorithm improvement that leads to a speedup of 20-60% over previous versions of Potrace. A new PDF backend was added, courtesy of Tor Andersson. An option --progress was added for displaying a progress bar. The Windows version of Potrace now uses MinGW instead of Cygwin, eliminating the need to install a special DLL alongside the executable programs, and solving some problems with wildcards and executable PostScript files. Some spurious "premature end of file" messages were eliminated. The core functionality of Potrace was separated into a library with a documented API, making it easier for developers to incorporate Potrace into other GPL-licensed software.

Downloading and installing

Potrace is built from sources using the standard configure/make commands. Please see the file INSTALL for generic installation instructions, and the file README for compile time configuration options specific to Potrace. Some pre-compiled binary distributions are also available. See the file README for instructions on how to install Potrace from a binary distribution. Additional instructions for Windows users are contained in the file README-WIN. If you would like to ensure the accuracy of the downloaded files, you can double-check their SHA1 sums.

Source distribution: potrace-1.8.tar.gz
Precompiled distributions: Linux (i386) potrace-1.8.linux-i386.tar.gz
Linux (Alpha) potrace-1.7.linux-alpha.tar.gz
Linux (AMD64) potrace-1.8.linux-amd64.tar.gz
Linux (Sparc) potrace-1.1.linux-sparc.tar.gz
Sun Solaris (Sparc) potrace-1.8.solaris-sparc.tar.gz
Sun Solaris (i386) potrace-1.7.solaris2.9-i386.tar.gz
FreeBSD (i386) potrace-1.7.freebsd4.6-i386.tar.gz
NetBSD (i386) potrace-1.7.netbsdelf-i386.tar.gz
OpenBSD (i386) potrace-1.7.openbsd3.4-i386.tar.gz
AIX potrace-1.8.aix-rs6000.tar.gz
Mac OS X (universal) potrace-1.8.mac-univ.tar.gz
Windows 95/98/2000/NT potrace-1.8.win32-i386.zip
potrace-1.8.win32-i386.tar.gz
AROS (i386) potrace-1.8.i386-aros.zip(1)
Packages: Redhat Binary RPM (i386) potrace-1.8-1.i386.rpm
Redhat Source RPM potrace-1.8-1.src.rpm
Debian Package (i386) potrace_1.7-1_i386.deb(2)
Redhat Binary RPM (64-bit) potrace-1.7-1.x86_64.rpm(3)
SuSE Binary RPM (i586) potrace_suse91-1.5-3.i586.rpm(4)
SuSE Binary RPM (64-bit) potrace_suse91-1.5-2.x86_64.rpm(4)
Solaris 9 Package (i386) potrace-1_7-i386-pc-solaris9.pkg.gz(5)
Solaris 10 Package (i386) potrace-1_8-i386-pc-solaris10.pkg.gz(5)
Amiga (OS4) potrace.lha (version 1.7)(6)
Package Management: Debian apt-get install potrace(2)
ArchLinux pacman -S potrace(7)
FreeBSD pkg_add -r potrace(8)
Fink (Mac OS X) fink install potrace(9)
Macports (Mac OS X) port install potrace(10)
(1) AROS binaries supplied by Matthias Rustler <mrustler at gmx.de>. See the AROS archives for sources and updates.
(2) Debian i386 Package maintained by Bartosz Fenski <fenio at debian.org>. Debian has a centralized package management and users may run "apt-get install potrace" as root to install.
(3) Redhat x86_64 Packages provided by Manuel Joriatti <manu-schwalbe at wanadoo.fr>.
(4) SuSE RPMs provided by Stanislav Brabec <sbrabec at suse.cz>. Potrace appears in the official SuSE distribution. Updates sometimes appear in the SuSE supplementary program.
(5) Solaris-i386 Packages provided by Apostolos Syropoulos <asyropoulos at gmail.com>.
(6) Amiga Package provided by Alfred Faust <alfred.j.faust at gmx.de>. See the OS4 Depot for updates.
(7) ArchLinux package maintained by Damir Perisa <damir at archlinux.org>. ArchLinux has a centralized package management and users need to run "pacman -S potrace" as root to install.
(8) FreeBSD Packages maintained by Piotr Smyrak <smyru at heron.pl>.
(9) Fink package maintained by Daniel Macks <dmacks at netspace.org>. Fink has a centralized package management and users need to run "fink install potrace" as root to install.
(10) Macports has a centralized package management and users need to run "port install potrace" as root to install.

Previous releases...

Usage

Potrace 1.8. Transforms bitmaps into vector graphics.

Usage: potrace [options] [file...]
General options:
 -h, --help                 - print this help message and exit
 -v, --version              - print version info and exit
 -l, --license              - print license info and exit
 -V, --show-defaults        - print compiled-in defaults and exit
 --progress                 - show progress bar
Input/output options:
 -o, --output file          - output to file
Backend selection:
 -e, --eps                  - EPS backend (encapsulated postscript) (default)
 -p, --postscript           - Postscript backend
 -s, --svg                  - SVG backend (scalable vector graphics)
 -g, --pgm                  - PGM backend (portable greymap)
 -b, --backend name         - select backend by name
Algorithm options:
 -z, --turnpolicy policy    - how to resolve ambiguities in path decomposition
 -t, --turdsize n           - suppress speckles of up to this size (default 2)
 -a, --alphamax n           - corner threshold parameter (default 1)
 -n, --longcurve            - turn off curve optimization
 -O, --opttolerance n       - curve optimization tolerance (default 0.2)
 -u, --unit n               - quantize output to 1/unit pixels (default 10)
 -d, --debug n              - produce debugging output of type n (n=1,2,3)
Scaling and placement options:
 -W, --width dim            - width of output image
 -H, --height dim           - height of output image
 -r, --resolution n[xn]     - resolution (in dpi)
 -x, --scale n[xn]          - scaling factor (pgm backend)
 -S, --stretch n            - yresolution/xresolution
 -A, --rotate angle         - rotate counterclockwise by angle
 -M, --margin dim           - margin
 -L, --leftmargin dim       - left margin
 -R, --rightmargin dim      - right margin
 -T, --topmargin dim        - top margin
 -B, --bottommargin dim     - bottom margin
Output options, supported by some backends:
 -C, --color #rrggbb        - set line color (default black)
 --fillcolor #rrggbb        - set fill color (default transparent)
 --opaque                   - make white shapes opaque
 --group                    - group related paths together
Postscript/EPS options:
 -P, --pagesize format      - page size (default is letter)
 -c, --cleartext            - do not compress the output
 -2, --level2               - use postscript level 2 compression (default)
 -3, --level3               - use postscript level 3 compression
 -q, --longcoding           - do not optimize for file size
PGM options:
 -G, --gamma n              - gamma value for anti-aliasing (default 2.2)
Frontend options:
 -k, --blacklevel n         - black/white cutoff in input file (default 0.5)
 -i, --invert               - invert bitmap

Dimensions can have optional units, e.g. 6.5in, 15cm, 100pt.
Default is inches (or pixels for pgm and gimppath backends).
Possible input file formats are: pnm (pbm, pgm, ppm), bmp.
Backends are: eps, postscript, ps, pdf, svg, pgm, gimppath, xfig.

For detailed usage information, see the potrace(1) man page.

Technical documentation

  • For detailed usage information, see the man pages of potrace(1) and mkbitmap(1).
  • A detailed technical description of how the Potrace algorithm works [ps, pdf].
  • Technical documentation of the Potrace library API (for developers) [ps, pdf].

Support and reporting bugs

Potrace has a project page on SourceForge. There, you will find facilities for reporting bugs, submitting patches, asking for support, asking for features, or discussing Potrace in general. You are encouraged to use these facilities. You can also send email to the author. Please also check the Frequently Asked Questions.

Dual licensing program

A non-GPL version of Potrace, called Potrace Professional(TM), is available for integration into proprietary software. Licenses are available from my company, Icosasoft Software Inc. If you wish to purchase a license, or for more information, please write to licensing@icosasoft.ca.

GUI's and related software

Commercial software:
  • Total Vectorize by CoolUtils. This Windows(TM) application makes vectorizing images simple and fun. Get the power of Potrace Professional(TM) in an easy-to-install and easy-to-use package. With one click, you can either vectorize a single image or a batch of images. Try it free for 30 days! (Added Feb 27, 2008).
Graphical user interfaces:
  • Potrace GUI, by Rasmus Andersson. A GUI for Potrace for Mac OS X. The source code is here. (Added Sept 22, 2003).

  • potracegui, by Antonio Fasolato. A GUI for Potrace using KDE. (Added Nov 29, 2003).

  • delineate, by Robert McKinnon. A GUI for Potrace and Autotrace using Java. There are versions for Mac OSX, GNU/Linux, and Windows. (Added Feb 11, 2003).

  • Rasterbater 1.0, by Kevin Cole. A GUI for Potrace using C#. (Added December 20, 2007).

  • CR8tracer, by Allan Murray. A Windows GUI for Potrace. (Added December 20, 2007).
Software that uses Potrace:
  • FontForge, by George Williams. An outline font editor that lets you create and edit postscript and truetype fonts, among others. This program can invoke Autotrace or Potrace for converting bitmaps to vector fonts. It used to be called "PfaEdit". (Added Aug 21, 2003).

  • mftrace, by Han-Wen Nienhuys. A small Python program that lets you trace a TeX bitmap font into a PFA or PFB font (A PostScript Type1 Scalable Font) or TTF (TrueType) font (Added Dec 13, 2003).

  • LilyPond, by Han-Wen Nienhuys and Jan Nieuwenhuizen. An application that let you typeset beautiful sheet music. It uses Potrace indirectly via mftrace. (Added Apr 22, 2004).

  • TeXtrace, by Péter Szabó. A collection of scripts that convert any TeX font into a Type1 .pfb outline font. The newest version (0.50) supports Potrace via the --potrace option. (Added Apr 22, 2004).

  • Inkscape, by various authors. This is an excellent SVG editor. I just received news that Potrace will be integrated in the next release, 0.40. (Added Sep 16, 2004).

  • dvisvgm, by Martin Gieseking. This is a utility for converting DVI files, as generated by TeX/LaTeX, to the XML-based Scalable Vector Graphics format. (Added Aug 24, 2005).

  • pocopo, by Paul Yoon. An AppleScript for processing color images, using Potrace. (Added Oct 28, 2005).

  • BMP 2 EPS, by Maddis. A Potrace front end for BluffTitler users. (Added Jun 21, 2009).
Ports of Potrace to other programming languages:
  • Vectorization, by Wolfgang Nagl. A translation of Potrace 1.8 to C# Visual Studio. (Added Aug 23, 2009).
Software that is similar to Potrace:
  • Autotrace, by Martin Weber. This program performs a similar task as Potrace. In my opinion, the output is not as nice, but it supports a much larger number of file formats, and it has been integrated with a larger number of other software packages. (Added Nov 29, 2003).
  • Vector Magic. A commercial tracing tool that is available through a web interface, for a fee. Unlike Potrace, Vector Magic works for color images.
Non tracing-based image enhancement software:
  • GREYCstoration, by David Tschumperlé. If the examples on the webpage are representative, then this is the most astonishingly good image regularization filter that I have ever seen. It is based on a non-linear diffusion technique. It can be used for noise and artifact removal, resizing, and inpainting (which means filling in missing image regions). It works on color photographs and cartoons. (Added Feb 2, 2006).
SVG Editors:

Articles about Potrace

Here are some web articles, listings, and web logs that cover Potrace and its applications. I particularly recommend the article by C. Scott Ananian on how to make stained glass windows from color scans using open source software. It is an amazing, step-by-step description of the process used, with beautiful screen shots. Similar techniques might also be applicable for vectorizing color cartoons.

Version

1.8

Author

Copyright © 2001-2007 Peter Selinger.

Logo

The Potrace logo and mascot was designed by Karol Krenski. Copyright © 2003 Karol Krenski and Peter Selinger. The logo is licensed under GPL.

License

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, or (at your option) any later version.

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.

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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

Trademarks

"Potrace" is a trademark of Peter Selinger. "Potrace Professional" and "Icosasoft" are trademarks of Icosasoft Software Inc. Other trademarks belong to their respective owners.

To my other software.
Peter Selinger / Department of Mathematics and Statistics / Dalhousie University
selinger@users.sourceforge.net / PGP key