By Virupaksha Aithal
Till AutoCAD 2014, AutoCAD used to take only BMP format images in CUI. As BMP format doesn't work with transparency, AutoCAD used to interpret RGB color 192,192,192 as transparent. AutoCAD users had used this workaround in CUI.
But the limitation of this approach is that the background color is fixed as 192,192,192. Any other background color will make the background visible in CUI.
From AutoCAD 2015 (and later versions), you can provide PNG images in CUI. As PNG format supports transparency, you can set the transparency for the images and hence the workaround to set the background color as 192,192,192 is not required.
If you have a BMP with specific background color (like 192,192,192) then “Bitmap.MakeTransparent” API call can convert passed color as Transparent. Refer below code which converts the BMP with 192,192,192 background color to Transparent PNG
using (Bitmap myBitmap = new Bitmap(@"C:\temp\transparent.bmp"))
//assuming that first pixel will have back ground color
Color backColor = myBitmap.GetPixel(0, 0);