public Bitmap ConvertFormat32To24(Bitmap source)
{
// 创建一个新的Bitmap,PixelFormat设置为Format24bppRgba
Bitmap convertedBitmap = new Bitmap(source.Width, source.Height, PixelFormat.Format24bppRgb);
// 使用Graphics对象来进行转换
using (Graphics graphics = Graphics.FromImage(convertedBitmap))
{
// 使用DrawImage方法进行格式转换
graphics.DrawImage(source, new Rectangle(0, 0, source.Width, source.Height));
}
return convertedBitmap;
}
C# bitmap Format32bppRgba转Format24bppRgb转
最新推荐文章于 2024-08-19 14:26:50 发布