How to make bmp Transparent
Posted on: Wed Jun 25 11:45:49 -0700 2008. Updated on: Wed Jun 25 11:47:53 -0700 2008.
Category: System.Drawing
Category: System.Drawing
So, lets say you are trying to draw a button dynamically using System.Drawing. You pull in the corners from an existing png file but the corner edges are white, so when overlaying they look funny.
Here is what we do:
Bitmap bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb);
Bitmap left = new Bitmap(Server.MapPath("~/custom/controls/button/btn_tall_off_left.png"));
left.MakeTransparent(Color.White);
The color you want to make transparent in the png is what you pass into the MakeTransparent() method.