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 ]