Sunday, January 19, 2014

Remove transparency in images with C#

Remove Transparency from png's in c# or asp net c#
public void RemoveTransparency(string filename)
{
   using (System.Drawing.Bitmap src = new System.Drawing.Bitmap(filename))
   {
      using (System.Drawing.Bitmap target = new System.Drawing.Bitmap(src.Size.Width, src.Size.Height))
      {
          using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(target))
          {
             g.Clear(System.Drawing.Color.White);
             g.DrawImage(src, 0, 0);  
          }
          target.Save("Full path of file");
      }
   }
}

3 comments:

  1. The method of execution is really impressive of writers of this blog. This team does really work hard and brings new information to its readers. I am connected with this blog very long and I am really thankful.โบท็อก

    ReplyDelete
  2. I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. remove background

    ReplyDelete