My GSoC journey with Synfig (part 1)

Ankit Dwivedi
4 min readJul 27, 2019

I got selected for GSoC at Synfig this year and in this post, I will explain my journey as well as my project “Vectorization of Bitmaps”

This is my second blog you can read the first one here

What is Synfig Studio?

Synfig Studio is a free and open-source 2D animation software, designed as a powerful industrial-strength solution for creating film-quality animation using a vector and bitmap artwork. It eliminates the need to create animation frame-by-frame, allowing you to produce 2D animation of a higher quality with fewer people and resources. Synfig Studio is available for Windows, Linux and Mac-OS X.

What do you mean by “Vectorization of Bitmaps”?

There are two main ways to represent a two-dimensional image, raster or vector graphics. Most image formats, such as JPG, GIF, BMP, and PNG, are raster graphics, also called bitmap graphics, meaning they store the image as a grid of pixels. However, raster graphics have some weak points. Most prominently, if a raster image is scaled, it becomes blurry and pixelated

Vector graphics are the solution to this problem.

So in process of vectorization(raster-to-vector conversion), we take a raster image and convert it to vectors, is not as simple as it sounds. There are a variety of algorithms to perform this, each producing different results since the vectorized image is just an approximation of the original image. After all, if the vectorized image looked just like the original, it would be no better than a raster image. I am using vectorization algorithm from opentoonz.

It is a multi-step process consisting :

  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.

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

4. Preserve Color — Fill back the colour from the original raster to the vector obtained.

I have implemented the algorithm to step 3. Looking forward to completing the rest part.

My Journey till now…

I started my project a bit earlier(mid-may). Tbh I was freaking out as I was busy in my exams for the past three weeks before GSoC and had lost the context. But gradually I was back on my pace. The environment is pretty chill in Synfig no one seems to be in a hurry. And due to my previous contributions at the time of Njack Winter of Code I already had a great bonding with my mentor Konstantin Dmitriev. In the first few weeks I worked on GUI and created the input dialog for the process. During the process I also experimented with glade(GUI builder for gtk). For the first month I made weekly posts about my progress, later I created milestones for every step to keep track of each step.

The GUI part was actually easy the real problem was how to check if my algorithm is working fine? I need to find some way to do that.

So after discussion with my mentor who also maintains a different version of Opentoonz(called morevna edition). He asked me to build opentoonz and do necessary changes in order to make checking possible in intermediate steps. After that I compared my output and opentoonz’s output after same steps to ensure I am going good.

Then comes the second problem the output points given by algorithm were meant for Bezier Curve but Synfig Outline works on Hermite so I wrote some conversion to convert any n degree Bezier Curve to Hermite.

As a mentee it was a lot to learn from a mentor who is org admin, artist, producer of an anime etc. I must say it is really difficult sometimes to be constantly motivated and keep moving ahead bit by bit when you are working remotely.

While writing this blog I just got the mail.

So one more evaluation to go! That’s it for now! [^_^]. See you after completing GSoC19.

--

--

Ankit Dwivedi

Engineer at Stripe | ex- Google | Building largescale systems