Simon Mattes Simon Mattes - 1 year ago 308
C# Question

JPEG decoder for .NET Core

there is currently no "built in" JPEG decoder class for .NET Core since System.Drawing (except for System.Drawing.Primitives) is currently not present as a nuget package.
I do understand that System.Drawing relies on underlying Win32 GDI code which obviously is not present on all platforms.

I did read some posts about possible implementations and there appear to be some alpha-grade JPEG packages on nuget but I haven't been able to find a proper one.

Does anyone know about a simple way of DECODING JPEG pictures on .NET Core for some server side processing? I don't even need resize or other functions, decoding would suffice perfectly.

Help is greatly appreciated.
Thanks in advance!


Answer Source

Have a look at

With a usage like in these samples:

Sample 1:

// resizing and filter (grayscale)
using (FileStream stream = File.OpenRead("foo.jpg"))
using (FileStream output = File.OpenWrite("bar.jpg"))
    Image image = new Image(stream);
    image.Resize(image.Width / 2, image.Height / 2)

Sample 2: Accessing Pixels

Image image = new Image(400, 400);
using (PixelAccessor<Color, uint> pixels = image.Lock())
    pixels[200, 200] = Color.White;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download