Skip to content

Latest commit

 

History

History
12 lines (12 loc) · 2.64 KB

drawing.md

File metadata and controls

12 lines (12 loc) · 2.64 KB

Caution

The System.Drawing namespace has some limitations for certain operating systems and application types.

  • On Windows, System.Drawing depends on the GDI+ native library, which is shipped as part of the OS. Some Windows SKUs, like Windows Server Core or Windows Nano, don't include this native library as part of the OS. If you use this namespace and the library can't be loaded, exceptions will be thrown at run time.

  • Some types in the System.Drawing namespace rely on GDI+, which is not supported in Windows services and ASP.NET Core and ASP.NET apps. These types are in the System.Drawing.Common NuGet package and include xref:System.Drawing.Bitmap?displayProperty=fullName and xref:System.Drawing.Font?displayProperty=fullName. However, primitive types in the namespace, such as xref:System.Drawing.Color?displayProperty=fullName, xref:System.Drawing.Size?displayProperty=fullName, xref:System.Drawing.Point?displayProperty=fullName, and xref:System.Drawing.Rectangle?displayProperty=fullName, can be used in any application.

  • In .NET 5 and previous versions, the System.Drawing.Common NuGet package works on Windows, Linux, and macOS. However, there are some platform differences. On Linux and macOS, the GDI+ functionality is implemented by the libgdiplus) library. This library is not installed by default in most Linux distributions and doesn't support all the functionality of GDI+ on Windows and macOS. There are also platforms where libgdiplus is not available at all. To use types from the System.Drawing.Common package on Linux and macOS, you must install libgdiplus separately. For more information, see Install .NET on Linux or Install .NET on macOS.

  • In .NET 6 and later versions, the System.Drawing.Common NuGet package is only supported on Windows operating systems. For more information, see System.Drawing.Common only supported on Windows.

If you can't use System.Drawing with your application, recommended alternatives include ImageSharp, SkiaSharp, Windows Imaging Components, and Microsoft.Maui.Graphics.