I am using .net core with C# on linux, lib System.Drawing is missing

五迷三道 提交于 2020-01-03 06:04:06

问题


Program.cs(1,14): error CS0234: The type or namespace name 'Drawing' does not exist in the namespace 'System' (are you missing an assembly reference?

Is it possible to fix that? or I am not meant to be using this lib, if I am developing in Linux with C#?


回答1:


The System.Drawing namespace is at the moment not part of corefx as it relies on the GDI+ features from Windows.

But there are plans to support it in the future.


But there are multiple alternatives:

CoreCompat.System.Drawing

CoreCompat.System.Drawing is a .NET Core port of the Mono implementation of System.Drawing. Like System.Drawing in .NET Framework and in Mono, CoreCompat.System.Drawing also relies on GDI+ on Windows. Caution is therefore advised, for the same reasons.

ImageSharp

ImageSharp is a brand new, pure managed code, and cross-platform image processing library. Its performance is not as good as that of libraries relying on native OS-specific dependencies, but it remains very reasonable. Its only dependency is .NET itself, which makes it extremely portable: there is no additional package to install, just reference ImageSharp itself, and you’re done.

Magick.NET

Magick.NET is the .NET wrapper for the popular ImageMagick library. ImageMagick is an open-source, cross-platform library that focuses on image quality, and on offering a very wide choice of supported image formats. It also has the same support for EXIF as ImageSharp.

(The .NET Core build of Magick.NET currently only supports Windows.)

SkiaSharp

SkiaSharp is the .NET wrapper for Google’s Skia cross-platform 2D graphics library, that is maintained by the Xamarin team. SkiaSharp is now compatible with .NET Core, and is extremely fast.

FreeImage-dotnet-core

This library is to the native FreeImage library what Magick.NET is to ImageMagick: a .NET Core wrapper. It offers a nice choice of image formats, good performance, and good visual quality.


Here are some good examples and performance analyses of the libraries mentioned above.



来源:https://stackoverflow.com/questions/44428405/i-am-using-net-core-with-c-sharp-on-linux-lib-system-drawing-is-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!