Skip to content

wivest/Image2SVG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image to SVG

Convert raster images to geometrical primitives. Implemented using C# and Skia Sharp.

Original

Original image

Recreated with 2000 shapes

Image recreated with 2000 shapes

Features

  • Set number of generated shapes
  • Downscale image before processing
  • Specify parameters of generation:
    • Count of new shapes per step
    • Number of mutations
    • Number of generations
  • Save as .svg file
  • Save generation progress as .webm file

Getting started

Prerequisites

The project is written in C#, so .NET 6.0 or higher is needed. Some third-party packages are used, that can be downloaded with the following command:

dotnet restore

FFMPEG

To save .webm animations FFMPEG binary is required. It can be found here. Then place binary in any folder you want and copy its path. Run the init command using the copied path:

dotnet run init <path>

Note

If you aren't going to generate animations, instead type anything into path.

Run the project

After initialization there are two folders: /images and /results. All images that are saved in the first folder are visible to the program. Second one contains generated .svgs and .webm animations.

Important

Results with the same name will be overwritten!

The signature of running command is following:

dotnet run <filename> [options]

Where filename is the name of file, saved in /images folder.

Options

To invoke help page (and see default values) run:

dotnet run -- -h
Option Description
--count Count of generated shapes.
--scale Rescale factor of image.
--samples Generated shape samples on start.
--mutations Mutations per generation.
--generations Number of generations.
--frames Frame rate in animation (0 is no animation).

About

Translate raster images to .svg files.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages