美文网首页
asp.net core 生成渐进图片

asp.net core 生成渐进图片

作者: 海玲珑 | 来源:发表于2017-07-07 11:20 被阅读0次

环境


VS2017、asp.net core 1.1

目的


将普通图片转换成渐进图片

代码如下

using(MagickImage image =newMagickImage("input.png"))

// input.png 包括图片的地址,这里就省略了

{

// Set the format and write to a stream so ImageMagick won't detect the file type.

image.Format = MagickFormat.Pjpeg;

using(FileStream fs =newFileStream("output.jpg", FileMode.Create))

{

image.Write(fs);

}

// Write to .jpg fileimage.Write("PJEG:output.jpg");

// Or to a .pjpeg fileimage.Write("output.pjpg");

}

以上的方法需要添加安装包 Magic.Net.Core-Q8

相关文章

网友评论

      本文标题:asp.net core 生成渐进图片

      本文链接:https://www.haomeiwen.com/subject/mqylhxtx.html