Perl bindings for Potrace
C Perl XS Perl6
Latest commit e2ae24c Sep 12, 2016 @polettix v0.76
   - Dist::Zilla cosmetics
   - Fix bug showing up in Mac OS X related to integer/long sizes
     (courtesy Boris Zentner)
     #3
   - Fix bug in EPS generator (courtesy Boris Zentner)

README.md

NAME

Graphics::Potrace - bindings to the potrace library

SYNOPSIS

# Step by step
use Graphics::Potrace qw< raster >;
my $raster = raster('
..........................
.......XXXXXXXXXXXXXXX....
..XXXXXXXX.......XXXXXXX..
....XXXXX.........XXXXXX..
......XXXXXXXXXXXXXXX.....
...XXXXXX........XXXXXXX..
...XXXXXX........XXXXXXX..
....XXXXXXXXXXXXXXXXXX....
..........................
');
my $vector = $raster->trace();
$vector->export(Svg => file => 'example.svg');
$vector->export(Svg => file => \my $svg_dump);
$vector->export(Svg => fh   => \*STDOUT);

# There is a simpler way to get a dump in a scalar
my $eps_dump = $vector->render('Eps');

# All in one facility
use Graphics::Potrace qw< trace >;
trace(
   raster => '
   ..........................
   .......XXXXXXXXXXXXXXX....
   ..XXXXXXXX.......XXXXXXX..
   ....XXXXX.........XXXXXX..
   ......XXXXXXXXXXXXXXX.....
   ...XXXXXX........XXXXXXX..
   ...XXXXXX........XXXXXXX..
   ....XXXXXXXXXXXXXXXXXX....
   ..........................
   ',
   vectorial => [ Svg => file => 'example.svg' ],
);

# There is a whole lot of DWIMmery in both raster() and trace().
# Stick to Graphics::Potrace::Raster for finer control
use Graphics::Potrace::Raster;
my $raster = Graphics::Potrace::Raster->load(
   Ascii => text => '
   ..........................
   .......XXXXXXXXXXXXXXX....
   ..XXXXXXXX.......XXXXXXX..
   ....XXXXX.........XXXXXX..
   ......XXXXXXXXXXXXXXX.....
   ...XXXXXX........XXXXXXX..
   ...XXXXXX........XXXXXXX..
   ....XXXXXXXXXXXXXXXXXX....
   ..........................
   ',
);
# you know what to do with $raster - see above!

DESCRIPTION

Potrace is a program (and a library) by Peter Selinger for Transforming bitmaps into vector graphics, distributed under the GNU GPL. This distribution aims at binding the library from Perl for your fun and convenience.

ALL THE REST

Want to know more? See the module's documentation to figure out all the bells and whistles of this module!

Want to contribute? Fork it on GitHub or at least read the relevant page.

That's all folks!