Save Bitmap as Png - CSharp System.Drawing

CSharp examples for System.Drawing:PNG

Description

Save Bitmap as Png

Demo Code


using System.Linq;
using System.Threading.Tasks;
using System.Drawing.Imaging;
using System.Drawing;
using System.Collections.Generic;
using System;// w  w w  . j  a v  a2s  . co m

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

Related Tutorials