1a7r0ch3 / img2svg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

img2svg

Approximates images in svg format.

input image output svg (polygonal)

1. Cloning

Use the recursive submodule option to clone the necessary submodules.

git clone --recurse-submodules https://github.com/loicland/img2svg

Otherwise, clone the following repo in the root:

2. Requirement

You need numpy, matplotlib

pip install numpy matplotlib

3. Installation

In a command prompt run:

python setup.py build_ext

Test with

python img2svg.py

4. Usage

python img2svg -f filename -r reg_strength -c contour_color -s stroke_width -o out_size -p output_path

With

  • -f file : path to image
  • -r reg_strength : how much simplification to do. Default = 1.0
  • -c contour_color : color of the contour, if any. Default = '' (no contour). Exemple : 'red'
  • -s stroke_width : width of the contour (only if contour_color != ''). Default = 2.0 (thick)
  • -o out_size : size of the largest side of the image. Default = 500
  • -p output_path : output path. Default = replace the image extension by `svg`

Coming soon

Bezier curves support.

About

License:GNU General Public License v3.0


Languages

Language:Python 100.0%