SOLVED: System.Drawing .NETCore on Mac, GDIPlus Exception

⚡️Hudson Ⓜ️endes
2 min readAug 18, 2018

--

Just caught a GDI+ error running System.Drawing on a Mac? Maybe I got what you need here, to solve it in 5 secs.

Context

If you are trying to generate thumbnails on .NETCore, you probably have come across of the porting of the System.Drawing namespace into mono.

If you haven't, check it out. It's a fantastic article about the several options for image processing on .NET Core that has some limitations.

https://blogs.msdn.microsoft.com/dotnet/2017/01/19/net-core-image-processing/

Problem

I got the whole thing up and running in debug. But when I went for our dotnet run, I got the following crash:

The type initializer for ‘System.Drawing.GDIPlus’ threw an exception. — -> System.DllNotFoundException: Unable to load DLL ‘gdiplus’: The specified module or one of its dependencies could not be found.

Solution

After googling a bit, I found out that macs have a brew package for the GDI+ good to go.

brew install mono-libgdiplus

And it works like a charm!
Hope this tiphelps you too, and saves you some minutes.

Wanna keep in Touch? LinkedIn!

My name is Hudson Mendes (@hudsonmendes), I’m a 38 years old coder, husband, father of 3, ex Startup Founder, ex-Peloton L7 Staff Tech Lead/Manager, nearly BSc in Computer Science by the University of London & Senior AI/ML Engineering Manager.

I’ve been on the Software Engineering road for 22+ years, and occasionally write about topics of interest to other Senior Engineering Managers and Staff Machine Learning Engineering with a bit of focus (but not exclusively) on Natural Language Processing.

Join me there, and I will keep you in the loop with my new learnings in AI/ML/LLMs and beyond!

--

--

⚡️Hudson Ⓜ️endes

⚡️Staff AI/ML Engineer & Senior Engineering Manager, #NLP, opinions are my own. https://linkedin.com/in/hudsonmendes