我试图在运行于Ubuntu 18.04的.Net Core Console应用程序中使用System.Drawing.Common创建位图,但是一旦执行代码,它就会向我显示:
The type initializer for 'Gdip' threw an exception. at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, Int32 format, HandleRef scan0, IntPtr& bitmap) at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format) at MidnightBot.Modules.AdminCommands.CreatePollAsync(String Term1, String Term2, String Description) in /home/MidnightBot/Modules/AdminCommands.cs:line 125 System.DllNotFoundException: Unable to load DLL 'libgdiplus': The specified module could not be found. at System.Runtime.InteropServices.FunctionWrapper`1.get_Delegate() at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output) at System.Drawing.SafeNativeMethods.Gdip..cctor()
我也尝试着做here所述的事情。但是没有成功。
感谢您的帮助。
答案 0 :(得分:3)
您需要使用软件包管理器安装gdiplus库。例如:
sudo apt-get install libgdiplus