Using libgdiplus with IronOCR: Setup Guide
.NET Core requires libgdiplus to use the Microsoft System.Drawing.Common nuget package. If it is not found on MacOS on Linux you may experience this exception:
- Unhandled exception. System.DllNotFoundException: Could not find or load the native library from any name: [ libgdiplus, libgdiplus.so ]
- If you see System.TypeInitializationException : The type initializer for 'Gdip' threw an exception then please read our System.Drawing.Common in NET6 guide instead.
Linux
Ubuntu, Debian
apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev
Docker
Add this line to Docker File it should work
RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev
macOS
Unhandled exception. System.DllNotFoundException: Could not find or load the native library from any name: [ libgdiplus, libgdiplus.dylib ]
- As a developer you may add the runtime.osx.10.10-x64.CoreCompat.System.Drawing Nuget package to your .NET solution to add libgdiplus to your project.
- Or manually install the
brew update && brew install mono-libgdiplus
- More information: https://docs.microsoft.com/en-us/dotnet/core/install/macos#libgdiplus