PlatformNotSupportedException: System.Drawing.Common is not supported on this platform
Since .NET 6, System.Drawing.Common only works on Windows; on Linux/macOS (including Docker) it throws.
Seen on:
.NET
Meaning
Image processing libraries depending on System.Drawing break when deployed to Linux containers. Switch to cross-platform libraries (ImageSharp, SkiaSharp).
Common causes
- Using System.Drawing (Bitmap, Graphics) on Linux/macOS
- Dependency (old PDF/QR/Excel lib) using System.Drawing
- Deploying a Windows-developed app to Linux containers
⚡ Quick fix
- Replace with SixLabors.ImageSharp or SkiaSharp
- Upgrade dependencies to versions without System.Drawing
- Run on Windows if you must keep it
Detailed fix by platform
C#
- csharp
using var image = await SixLabors.ImageSharp.Image.LoadAsync(input); image.Mutate(x => x.Resize(800, 0)); await image.SaveAsJpegAsync(output);
How to diagnose
- Platform — Linux/macOS/container?
- Dependency — Which library uses System.Drawing?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in .NET
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026