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.
- 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 | ✅ | ✅ |
- .NET 9, .NET 8, .NET 7, .NET 6, .NET 5, .NET Core, Standard, and Framework
- Windows, macOS, Linux, Docker, Azure, and AWS
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.
usingIronSoftware.Drawing;// Create a new AnyBitmap objectvarbitmap=AnyBitmap.FromFile("FILE_PATH");bitmap.SaveAs("result.jpg");varbytes=bitmap.ExportBytes();varresultExport=newSystem.IO.MemoryStream();bitmap.ExportStream(resultExport,AnyBitmap.ImageFormat.Jpeg,100);// Casting between System.Drawing.Bitmap and IronSoftware.Drawing.AnyBitmapSystem.Drawing.Bitmapimage=newSystem.Drawing.Bitmap("FILE_PATH");IronSoftware.Drawing.AnyBitmapanyBitmap=image;anyBitmap.SaveAs("result-from-casting.png");// Creates a Multi-page Tiff-style AnyBitmap from an Image arrayList<AnyBitmap>bitmaps=newList<AnyBitmap>(){AnyBitmap.FromFile("FILE_PATH_1"),AnyBitmap.FromFile("FILE_PATH_2")};AnyBitmapanyBitmap=AnyBitmap.CreateMultiFrameTiff(bitmaps);// Creates a Multi-page Tiff-style AnyBitmap from a fully qualified file path arrayList<string>imagePaths=newList<string>(){"FILE_PATH_1","FILE_PATH_2"};AnyBitmapanyBitmap=AnyBitmap.CreateMultiFrameTiff(imagePaths);// Manipulate image framesintframeCount=anyBitmap.FrameCount;List<AnyBitmap>frames=(List<AnyBitmap>)anyBitmap.GetAllFrames;usingIronSoftware.Drawing;// Create a new Color objectColorfromHex=newColor("#191919");ColorfromRgb=newColor(255,255,0);ColorfromEnum=Color.Crimson;// Casting between System.Drawing.Color and IronSoftware.Drawing.ColorSystem.Drawing.ColordrawingColor=System.Drawing.Color.Red;IronSoftware.Drawing.ColorironColor=drawingColor;ironColor.A;ironColor.R;ironColor.G;ironColor.B;// Luminance is a value from 0 (black) to 100 (white) where 50 is the perceptual "middle grey"ironColor.GetLuminance();// Gets the 32-bit ARGB value of this Color structure.ironColor.ToArgb();usingIronSoftware.Drawing;// Create a new Rectangle objectRectanglerectangle=newRectangle(5,5,50,50);// Create a new Rectangle object with MeasurementUnitsRectanglemmRectangle=newRectangle(5,5,50,50,MeasurementUnits.Millimeters);// Convert between MeasurementUnitsRectanglepxRectangle=mmRectangle.ConvertTo(MeasurementUnits.Millimeters);// Or specify DPIRectanglepxRectangleWithDPI=mmRectangle.ConvertTo(MeasurementUnits.Millimeters,200);// Casting between System.Drawing.Rectangle and IronSoftware.Drawing.RectangleSystem.Drawing.Rectanglerectangle=newSystem.Drawing.Rectangle(10,10,150,150);IronSoftware.Drawing.RectangleironRectangle=rectangle;ironRectangle.X;ironRectangle.Y;ironRectangle.Width;ironRectangle.Height;usingIronSoftware.Drawing;// Create a new Size objectSizesize=newSize(50,50);// Casting between System.Drawing.Size and IronSoftware.Drawing.SizeSystem.Drawing.SizesystemSize=newSystem.Drawing.Size(150,150);IronSoftware.Drawing.SizeironSize=systemSize;ironSize.Width;ironSize.Height;usingIronSoftware.Drawing;// Create a new Font objectFontfont=newFont("Times New Roman",FontStyle.Italic|FontStyle.Bold,30);// Casting between System.Drawing.Font and IronSoftware.Drawing.FontSystem.Drawing.FontdrawingFont=newSystem.Drawing.Font("Courier New",30);IronSoftware.Drawing.FontironFont=drawingFont;ironFont.FamilyName;ironFont.Style;ironFont.Size;ironFont.Italic;ironFont.Bold;For more information about Iron Software please visit our website: https://ironsoftware.com/
For general support and technical inquiries, please email us at: support@ironsoftware.com