This is a .Net Core compatible System.Drawing implementation modified from mono project.
Works on windows and linux.
Since 3.0, namespace is replaced to System.DrawingCore, please modify your code after upgrade.
Since 4.0, netstandard 2.0 is required, and code is updated to mono 5.2.0.215.
These system are tested:
- Windows 8.1 64bit
- Ubuntu Server 16.04 LTS 64bit
- Fedora 24 64bit
- CentOS 7.2 64bit
These features should work:
- Open jpg, bmp, ico, png
- Save jpg, bmp, ico, png
- Resize image
- Draw graphics with brush and pen
- Open font and draw string
Known issues:
- #1 Save icon file large than 255x255 will cause arithmetic overflow error
Microsoft will ship their System.Drawing soon,
it's also modified from mono and I believe it's more stable than mine,
so this project may discontinue soon after offical System.Drawing available.
On windows, just install package ZKWeb.System.Drawing from nuget.
On Linux, except install package ZKWeb.System.Drawing from nuget, you need install libgdiplus.
- Ubuntu 16.04 and above:
- apt-get install libgdiplus
- cd /usr/lib
- ln -s libgdiplus.so gdiplus.dll
- Fedora 23 and above:
- dnf install libgdiplus
- cd /usr/lib64/
- ln -s libgdiplus.so.0 gdiplus.dll
- CentOS 7 and above:
- yum install autoconf automake libtool
- yum install freetype-devel fontconfig libXft-devel
- yum install libjpeg-turbo-devel libpng-devel giflib-devel libtiff-devel libexif-devel
- yum install glib2-devel cairo-devel
- git clone https://github.com/mono/libgdiplus
- cd libgdiplus
- ./autogen.sh
- make
- make install
- cd /usr/lib64/
- ln -s /usr/local/lib/libgdiplus.so gdiplus.dll
Then you should replace all System.Drawing To System.DrawingCore in your code
- No fake strong name is used, will not mess up Asp.Net and OWIN.
- Copied all files from mono 5.2.0.215, you will actually compile it without seeing hundreds error
- Really tested on linux and really work
- You can actually run tests from
dotnet test, no joke- Windows
- .Net Core 2.0: Test Count: 1905, Passed: 1528, Failed: 367, Warnings: 0, Inconclusive: 0, Skipped: 10
- .Net Framework 4.6.1: Test Count: 1941, Passed: 1557, Failed: 374, Warnings: 0, Inconclusive: 0, Skipped: 10
- Linux
- .Net Core 2.0: Test Count: 1906, Passed: 1522, Failed: 375, Warnings: 0, Inconclusive: 0, Skipped: 9
- Windows
- No reference to System.Drawing.Primitive, because System.Drawing.Primitive reference original System.Drawing on .Net Framework which may cause conficts error
- Namespace is renamed from
System.DrawingtoSystem.DrawingCorethat make it compatible with .Net Core 2.0
Not tested yet.