System.Drawing.Common is not supported 🟪 .NET

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

  1. Replace with SixLabors.ImageSharp or SkiaSharp
  2. Upgrade dependencies to versions without System.Drawing
  3. Run on Windows if you must keep it

Detailed fix by platform

C#

  1. csharp
    using var image = await SixLabors.ImageSharp.Image.LoadAsync(input);
    image.Mutate(x => x.Resize(800, 0));
    await image.SaveAsJpegAsync(output);

How to diagnose

  1. Platform — Linux/macOS/container?
  2. 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:

🧠 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.