1、nuget 引用
通过命令或者界面引用MagickImage包
2、压缩图片
采用JPEG2000压缩方式,压缩质量因子Quality可以根据自己需要调节
public static void JPEG2000Compression()
{
var inputFilePath = @"C:\Users\Administrator\Desktop\input.tif";
var outputFilePath = @"C:\Users\Administrator\Desktop\output.jpg";
using (MagickImage image = new MagickImage(inputFilePath))
{
image.SetCompression(CompressionMethod.JPEG2000);
image.Quality = 30;//进行压缩 默认为75
image.Write(outputFilePath);
image.Dispose();
}
}
标签:Administrator,压缩,MagickImage,Desktop,JPEG2000,image
From: https://www.cnblogs.com/SunSpring/p/17442381.html