IronSoftware.System.Drawing
An open-source System.Drawing.Common replacement for .NET 5 and above on all platforms. Bringing together System.Drawing, Maui, and ImageSharp's Bitmap, Image, Font, and Shape types via an agnostic free NuGet package.
Install / Use
/learn @iron-software/IronSoftware.System.DrawingREADME
IronSoftware.Drawing - Image, Color, Rectangle, and Font class for .NET Applications
IronSoftware.Drawing is an open-source library originally developed by Iron Software that helps C# Software Engineers to replace System.Drawing.Common in .NET projects.
Table of Contents
IronSoftware.Drawing Features:
- AnyBitmap: A universally compatible Bitmap class. Implicit casting between
IronSoftware.Drawing.AnyBitmapand following popular Bitmap/Image formats supported:
| Implicit Casting Support | To AnyBitmap Supported | From AnyBitmap Supported |
|------------------------------------------------------------------------|:--------------------------:|:----------------------------:|
| System.Drawing.Bitmap | ✅ | ✅ |
| System.Drawing.Image | ✅ | ✅ |
| SkiaSharp.SKBitmap | ✅ | ✅ |
| SkiaSharp.SKImage | ✅ | ✅ |
| SixLabors.ImageSharp | ✅ | ✅ |
| Microsoft.Maui.Graphics.Platform.PlatformImage | ✅ | ✅ |
- Color: A universally compatible Color class. Implicit casting between
IronSoftware.Drawing.Colorand following popular Color formats supported:
| Implicit Casting Support | To Color Supported | From Color Supported |
|-----------------------------------|:--------------------:|:----------------------:|
| SkiaSharp.SKColor | ✅ | ✅ |
| SixLabors.ImageSharp.Color | ✅ | ✅ |
| SixLabors.ImageSharp.PixelFormats | ✅ | ✅ |
- Rectangle: A universally compatible Rectangle class. Implicit casting between
IronSoftware.Drawing.Rectangleand following popular Rectangle formats supported:
| Implicit Casting Support | To Rectangle Supported | From Rectangle Supported | To RectangleF Supported | From RectangleF Supported |
|--------------------------------|:----------------------------:|:------------------------------:|:----------------------------:|:------------------------------:|
| System.Drawing.Rectangle | ✅ | ✅ | | |
| System.Drawing.RectangleF | | | ✅ | ✅ |
| SkiaSharp.SKRect | | | ✅ | ✅ |
| SkiaSharp.SKRectI | ✅ | ✅ | | |
| SixLabors.ImageSharp.Rectangle | ✅ | ✅ | | |
| SixLabors.ImageSharp.RectangleF | | | ✅ | ✅ |
- Size: A universally compatible Size class. Implicit casting between
IronSoftware.Drawing.Sizeand following popular Size formats supported:
| Implicit Casting Support | To Size Supported | From Size Supported | To SizeF Supported | From SizeF Supported |
|--------------------------------|:----------------------------:|:------------------------------:|:----------------------------:|:------------------------------:|
| System.Drawing.Size | ✅ | ✅ | | |
| System.Drawing.SizeF | | | ✅ | ✅ |
| SkiaSharp.SKSize | | | ✅ | ✅ |
| SkiaSharp.SKSizeI | ✅ | ✅ | | |
| SixLabors.ImageSharp.Size | ✅ | ✅ | | |
| SixLabors.ImageSharp.SizeF | | | ✅ | ✅ |
| Microsoft.Maui.Graphics.Size | ✅ | ✅ | | |
| Microsoft.Maui.Graphics.SizeF | | | ✅ | ✅ |
- Font: A universally compatible Font class. Implicit casting between
IronSoftware.Drawing.Fontand following popular Font formats supported:
| Implicit Casting Support | To Font Supported | From Font Supported |
|----------------------------|:-------------------:|:---------------------:|
| System.Drawing.Font | ✅ | ✅ |
| SkiaSharp.SKFont | ✅ | ✅ |
| SixLabors.Fonts.Font | ✅ | ✅ |
- Point and PointF: Universally compatible Point and PointF classes. Implicit casting between
IronSoftware.Drawing.PointandIronSoftware.Drawing.PointFand the following supported:
| Implicit Casting Support | To Point Supported | From Point Supported | To PointF Supported | From PointF Supported |
|--------------------------------|:----------------------------:|:------------------------------:|:----------------------------:|:------------------------------:|
| System.Drawing.Point | ✅ | ✅ | | |
| System.Drawing.PointF | ✅ | ✅ | | |
| SixLabors.ImageSharp.Point | ✅ | ✅ | | |
| SixLabors.ImageSharp.PointF | | | ✅ | ✅ |
| Microsoft.Maui.Graphics.Point | ✅ | ✅ | | |
| Microsoft.Maui.Graphics.PointF | | | ✅ | ✅ |
| SkiaSharp.SKPoint | | | ✅ | ✅ |
| SkiaSharp.SKPointI | ✅ | ✅ | | |
IronSoftware.Drawing has cross platform support compatibility with:
- .NET 9, .NET 8, .NET 7, .NET 6, .NET 5, .NET Core, Standard, and Framework
- Windows, macOS, Linux, Docker, Azure, and AWS
Using IronSoftware.Drawing
Installing the IronSoftware.Drawing NuGet package is quick and easy, please install the package like this:
PM> Install-Package IronSoftware.System.Drawing
Alternatively, download directly from the official NuGet website.
Once installed, you can get started by adding using IronSoftware.Drawing; to the top of your C# code.
AnyBitmap Code Example
using IronSoftware.Drawing;
// Create a new AnyBitmap object
var bitmap = AnyBitmap.FromFile("FILE_PATH");
bitmap.SaveAs("result.jpg");
var bytes = bitmap.ExportBytes();
var resultExport = new System.IO.MemoryStream();
bitmap.ExportStream(resultExport, AnyBitmap.ImageFormat
