Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GSoC 19] Vectorization of bitmaps #930

merged 143 commits into from Aug 31, 2019


Copy link

commented Aug 21, 2019

Google Summer of Code 2019 - Report

Student: Ankit Kumar Dwivedi (@ankit-kumar-dwivedi )
Mentor: Konstantin Dmitriev (@morevnaproject ), Artem Konoplin (@ice)
Project: Vectorization of Bitmaps

Link to feature repository/branch ->


Created a Convert-to-Vector Feature that allows converting bitmap images into vector graphics. This is done by porting vectorization algorithm from OpenToonz animation package.

Now it is possible to right click on Image Layer and select "Convert to Vectors..." command.

Convert-to-vector command
Figure - Convert-to-vector command in menu

Clicking on it opens a vectorizer settings dialog where you can set

  • Threshold - sets the value of the darkest pixels to be taken into account to detect lines to be converted to vector
  • Acurracy - sets how much the vector stroke will follow the shape of the original drawing lines. High values create more precise strokes but makes them more complex.
  • Despeckling - ignores during the conversion small areas generated by the image noise; the higher the value, the larger the areas ignored.
  • Max thickness - sets the maximum vector stroke thickness; if this value is low very thick lines will be converted in two centerline strokes defining the line outline; if this value is high, they will be converted in a single centerline stroke.

Vectorizer settings dialog
Figure - Vectorizer settings dialog with input parameters

Implementation details

Algorithm Overview

Vectorization process consist of the following steps: :

  1. Polygonization — Extracts a polygonal, minimal yet faithful representation of image contours.

  2. Skeletonization — the process of skeletonization reduces all objects in an image to lines, without changing the essential structure of the image. image

  3. Convert to strokes — convert the sequence into strokes. I used Hermite curves for the stroke creation however bezier curve is most common.

Code Overview

  1. vectorizersettings - Dialog box to take input configuration for further process. All the inputs are then passed to vectorization action.
  2. vectorization action - It checks if all params are correct and pass the layer along with configuration to vectorizer.
  3. polygonizerclasses.h - This header contains all the common class definition that is used in subsequent steps and the prototype of all functions being used in centerlinevectorizer
  4. vectorizerparameter.h - It contain the VectorizerConfiguration class and parameters definitions
  5. centerlinevectorizer - This contains series of functions that are part of centerline vectorization
    • centerlinepolygonizer - This used the pixel data to extracts a polygonal, minimal yet faithful representation of image contours
    • centerlineskeletonizer - skeletonization reduces all objects in an image to lines, without changing the essential structure of the image. The output of this step is a list of unrelated skeletons
    • organizeGraphs - The raw skeleton data obtained from Skeletonizer class need to be grouped in joints and sequences before proceeding further.
    • centerlinetostrokes - Converts each forward or single Sequence of the image in its corresponding Stroke using outline layer in synfig. If the max thickness is zero then outline vectorization happen otherwise centerlines are created. centerlinetostrokes return a list of outline layers which are added to synfig as they are returned back to vectorization action.



Demonstration video
IDemonstration video

Output example 1

Output example 2


It would be nice to have a progressbar displayed while vectorization process is running. There are also some other minor issues that do not affect main functionality, you can see full list of them here -

Blog posts

How I got selected for GSoC 2019 with Synfig

My GSoC journey with Synfig (part 1)

My GSoC journey with Synfig (part 2)


I gratefully acknowledge the assistance of my mentors and synfig team for what they did in the project while facing a time and space difference. I have gained a lot as it is my first time working with professional developers, open-source community and an established software program. The experiences and challenges I have been given in the project are profound for my growth and future development. I will keep contributing to the synfig and the fantastic community behind this great project.


This comment has been minimized.

Copy link

commented Aug 21, 2019

Congratulations! can't wait to see more of your contributions. The community surely needs more people that care about the software and for sure it is always an investment for your own growth as a developer to tackle different kinds of problems. Good luck with your studies and your own professional software development career! 😄

@morevnaproject morevnaproject changed the title [GSoC19] Vectorization of bitmaps - Final Submission [GSoC 19] Vectorization of bitmaps Aug 24, 2019

@morevnaproject morevnaproject removed this from the Vectorization of bitmaps milestone Aug 25, 2019


This comment has been minimized.

Copy link

commented Aug 31, 2019

@ankit-kumar-dwivedi Please rebase your branch on top of the latest master branch and I will merge your changes.

@ankit-kumar-dwivedi ankit-kumar-dwivedi force-pushed the ankit-kumar-dwivedi:vectorization branch from 97f25f6 to 16a7cf8 Aug 31, 2019


This comment has been minimized.

Copy link
Member Author

commented Aug 31, 2019

Done :)

@morevnaproject morevnaproject merged commit 04b1a8c into synfig:master Aug 31, 2019

3 checks passed

Travis CI - Pull Request Build Passed
continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed

This comment has been minimized.

Copy link

commented Sep 1, 2019

@ankit-kumar-dwivedi Merged into master now. Congratulations!!! ^__^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.