环境:
- Debian
- .net 6
问题: The type initializer for ‘Gdip’ threw an exception
因为代码中使用 SixLabors.ImageSharp去处理图片,在window上是正常的,在linux上就报错了:The type initializer for ‘Gdip’ threw an excepti。
解决办法:
执行如下命令:
sudo apt-get install libgdiplus
如果是centos的话使用:
yum install libgdiplus -y
即可!
在Debian或CentOS系统上运行使用SixLabors.ImageSharp处理图片的代码时,可能会遇到'TypeInitializer for 'Gdip' threw an exception'的错误。为了解决这个问题,只需在Linux环境中安装libgdiplus库。对于Debian系统,可以执行'sudo apt-get install libgdiplus',而在CentOS系统上则需运行'yum install libgdiplus -y'。完成安装后,异常将得到解决。

140

被折叠的 条评论
为什么被折叠?



