Runnable C# examples for IronDrawing, a free and open-source .NET graphics library that replaces System.Drawing.Common with types that convert implicitly to and from SkiaSharp, ImageSharp, MAUI Graphics, and System.Drawing itself.
dotnet add package IronSoftware.System.Drawingusing IronSoftware.Drawing;
// Load an image from disk into an AnyBitmap
var bitmap = AnyBitmap.FromFile("input.png");
// Save it back out in a different format
bitmap.SaveAs("result.jpg");
// Export to a byte array or a stream for network or database use
byte[] bytes = bitmap.ExportBytes();
using var stream = new MemoryStream();
bitmap.ExportStream(stream, AnyBitmap.ImageFormat.Jpeg, 100);AnyBitmap converts implicitly to and from System.Drawing.Bitmap, SkiaSharp.SKBitmap, SixLabors.ImageSharp.Image, and Microsoft.Maui.Graphics.Platform.PlatformImage, so it can sit between two libraries that would otherwise not agree on an image type. Color, Rectangle, Size, Point, and Font behave the same way.
IronDrawing is free and open source — no license key is required.
Each folder contains a self-contained .NET project you can open and run:
examples/— focused snippets demonstrating individual featuresquickstart/— an end-to-end project scaffold
- Loading, cloning, and saving
AnyBitmapimages across formats - Casting between
AnyBitmapandSystem.Drawing, SkiaSharp, ImageSharp, and MAUI image types - Exporting images to
byte[]andMemoryStream, and to a string withToString() - Reading and setting individual pixels
- Multi-frame images: creating multi-page TIFF and GIF, counting frames, extracting a single frame
- Color creation, 32-bit ARGB conversion, and color-depth inspection
CropRectangleconstruction, casting, and measurement-unit conversionPoint,PointF,Rectangle,RectangleF,Size, andSizeFarithmetic, casting, and equality
.NET Standard 2.0 and .NET 6 — which covers .NET 8, 7, 6, 5, .NET Core, and .NET Framework 4.6.1+. Windows, macOS, Linux, Docker, Azure, and AWS. See the documentation for environment-specific notes.
- Full documentation: ironsoftware.com/open-source/csharp/drawing/docs
- API reference: ironsoftware.com/open-source/csharp/drawing/object-reference/api
- Library source and issues: github.com/iron-software/IronSoftware.System.Drawing
- Issues with these examples: file directly on this repository
- Product support: support@ironsoftware.com
This repository is maintained by Iron Software. IronDrawing is free and open source; the rest of the Iron Suite is commercial.