Save Bitmap as Jpeg - CSharp System.Drawing

CSharp examples for System.Drawing:JPEG

Description

Save Bitmap as Jpeg

Demo Code


using System.Linq;
using System.Threading.Tasks;
using System.Drawing.Imaging;
using System.Drawing;
using System.Collections.Generic;
using System;//from  ww w  . j av  a 2 s . c  o m

public class Main{
        public static void SaveJpeg(this Bitmap img, string filePath, long quality)
        {
            var encoderParameters = new EncoderParameters(1);
            encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, quality);
            img.Save(filePath, GetEncoder(ImageFormat.Jpeg), encoderParameters);
        }
}

Related Tutorials