SkiaSharp vs System.Drawing

MAkif DERE
2 min readOct 6, 2020

This story is inspired by this article. I was developing a .net core project with System.Drawing library. Everything was ok at first.

A part of the project was containing that image files need to draw on a different colored background. I want to share sample files for you to imagine more simply.

input png with alpha channel

The customer wanted it on a green background(#008000 hex color code). I developed it with System.Drawing Library, and it was working as expected in my locale, macOS. After that, I deployed it to our Linux Server.

At that point, I realized that the output in the server was different from the locale one. I also verified expected result on Windows machine. However, the version on the server was not satisfactory. I searched to improve my code during two days. But unfortunately, I did not find any good approach to solve this distortion with System.Drawing Library.

Distorted output in Linux Environment
Distorted output in Linux Environment

During this time, I also upgraded my project from .net core 3.1 to .net 5.0 in the hope that System.Drawing would be fixed. I didn’t want to install .net 5.0 to server. Because there were other projects still running with .net core 3.1 framework. So, I dockerized the project to test it with .net 5.0 framework on Linux Environment. The distortion has still occurred.

Desired output in Mac and Windows Environments

After that, I decided to change the drawing library. I had a quick search about it. I found this blog. There was an excellent comparison. But each picture does not make any sense for normal eyes. Eventually, I had to choose one of them. It was SkiaSharp for the Google keyword about it. It didn’t let me down.

My sample project can be found on GitHub.

--

--