예제 #1
0
        public static void Save(Image img, string path, ImgCodes code, int quality)
        {
            var qualityParam  = new EncoderParameter(Encoder.Quality, quality);
            var codecInfo     = GetCodeInfo(code);
            var encoderParams = new EncoderParameters(1);

            encoderParams.Param[0] = qualityParam;
            img.Save(path, codecInfo, encoderParams);
        }
예제 #2
0
 public static ImageCodecInfo GetCodeInfo(ImgCodes code)
 {
     return(ImageCodecInfo.GetImageEncoders().FirstOrDefault(m => m.MimeType == codes[code]));
 }