1.在docker 上找到并运行需要System.Drawing的镜像 然后退出执行另一语句 docker run -it container01 进入镜像以方便安装gdiplus docker exec -ti container01 /bin/bash 执行更新环境 apt-get update 下载安装gdiplus apt-get install libgdiplus 退出镜像 exit 提交安装到镜像中 docker commit container01 此时镜像运行后就可以支持sys…
前言 在项目迁移到 .net core 上面后,我们可以使用 System.Drawing.Common 组件来操作 Image,Bitmap 类型,实现生成验证码.二维码,图片操作等功能.System.Drawing.Common 组件它是依赖于 GDI+ 的,然后在 Linux 上并没有 GDI+,面向谷歌编程之后发现,Mono 团队使用 C语言 实现了GDI+ 接口,提供对非Windows系统的 GDI+ 接口访问能力,这个应该就是libgdiplus.所以想让代码在 linux 上稳定运…
在dockerfile 中添加 FROM microsoft/dotnet:2.1-aspnetcore-runtime RUN apt-get update RUN apt-get install -y --no-install-recommends libgdiplus libc6-dev 为什么会找不到 libdl (libdl.so.2) 呢?是因为 System.Drawing.Common 是在 /usr/lib/x86_64-linux-gnu/ 这个路径中找的,而容器中 libd…
Asp.Net Core 2.1发布后,正式支持System.Drawing.Common绘图了,可以用来做一些图片验证码之类的功能.但是把网站部署到docker容器里运行会遇到很多问题,也是非常闹心的,本文记录这些问题,希望帮到有需要的人. 创建网站 前提条件:安装最新版VS2017和Net Core SDK 2.1. 首先新建网站,选择Asp.Net Core 2.1 Web应用程序(模型视图控制器),不勾选docker,我习惯自行编写Dockerfile. 指定网站访问端口5000. pu…
netcore发布到centos 使用的是Zkweb.system.drawing生成验证码,发布后可能会出现不显示及乱码的情况 1.验证码图片不显示(通过日志会发现生成图片时代码已经异常) Zkweb.system.drawing开源地址 https://github.com/zkweb-framework/zkweb.system.drawing 先按照官方步骤执行 yum install autoconf automake libtool yum install freetype-deve…
.net core的bitmap使用的是以下类库,但无法在linux运行 https://github.com/CoreCompat/CoreCompat 在linux运行需要安装runtime.linux-x64.CoreCompat.System.Drawing https://www.nuget.org/packages/runtime.linux-x64.CoreCompat.System.Drawing  如果你的是.net core2.0,那么是使用v2类库 https://www.…
本文介绍.Net Core下用第三方ZKWeb.System.Drawing实现验证码功能. 通过测试的系统: Windows 8.1 64bit Ubuntu Server 16.04 LTS 64bit Fedora 24 64bit CentOS 7.2 64bit 可以实现以下功能: Open jpg, bmp, ico, png Save jpg, bmp, ico, png Resize image Draw graphics with brush and pen Open font…
System.ArgumentException The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound] Description: HTTP 500.Error processing request. Details: Non-web exception. Exception origin (name of application or object): System.Drawing. Excep…
C#中对图片的操作主要是通过System.Drawing.Image等类进行. 一.将图片转换为字节流 /// <summary> /// 图片处理帮助类 /// </summary> public static class PicProcessHelper { /// <summary> /// 将图片转换为指定的字节流 /// </summary> /// <param name="filePath">图片路径</p…
最近在尝试Direct2D编程,挺好玩的. 但是有时候还是会用到GDI+来生成图片,但D2D绘图需要用到自己的D2DBitmap类. 因此需要转换,查阅了下网上的资料,写了这么一个方法: using System; using System.Windows.Forms; using System.Linq; using System.Text; using System.Diagnostics; using DX = SharpDX; using D2D = SharpDX.Direct2D1;…