Loading

C#原图保存

bitPhoto.Save(Response.OutputStream, ImageFormat.Jpeg);
图像保存的问题,默认的质量是60%

            EncoderParameter p;
            EncoderParameters ps;

            ps = new EncoderParameters(1);

            p = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
            ps.Param[0] = p;

            ImageCodecInfo ii = GetCodecInfo("image/jpeg");
            bitPhoto.Save(Response.OutputStream,ii,ps);

        private ImageCodecInfo GetCodecInfo(string mimeType)
        {
            ImageCodecInfo[] CodecInfo = ImageCodecInfo.GetImageEncoders();
            foreach (ImageCodecInfo ici in CodecInfo)
            {
                if (ici.MimeType == mimeType) return ici;
            }
            return null;
        }

  

posted @ 2021-06-19 16:57  jevan  阅读(95)  评论(0编辑  收藏  举报