标签:span 压缩 com util bmp pdo click cin isp
代码:
private static ImageCodecInfo GetImageCodecInfo(ImageFormat imageFormat) { ImageCodecInfo[] imageCodecInfoArr = ImageCodecInfo.GetImageDecoders(); foreach (ImageCodecInfo imageCodecInfo in imageCodecInfoArr) { if (imageCodecInfo.FormatID == imageFormat.Guid) { return imageCodecInfo; } } return null; }
代码:
MemoryStream ms = HttpUtil.HttpDownloadFile(url); Bitmap bmp = new Bitmap(ms); EncoderParameters encoderParameters = new EncoderParameters(1); EncoderParameter encoderParameter = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 75L); encoderParameters.Param[0] = encoderParameter; MemoryStream msCompress = new MemoryStream(); bmp.Save(msCompress, GetImageCodecInfo(ImageFormat.Jpeg), encoderParameters); Bitmap bmpCompress = new Bitmap(msCompress); bmpCompress.Save(path); bmp.Save(path2); msCompress.Close(); ms.Close();
标签:span 压缩 com util bmp pdo click cin isp
原文地址:https://www.cnblogs.com/s0611163/p/9529497.html