首页 新闻 会员 周边

Format8bppIndexed转 Format24bppRgb问题

0
悬赏园豆:10 [已解决问题] 解决于 2009-02-24 13:26

bmp是Format8bppIndexed格式的(是带索引值的所有不能作相关的操作)通过

 Rectangle rec = new Rectangle(0, 0, bmp.Width, bmp.Height);

bmp= bmp.Clone(rec , PixelFormat.Format24bppRgb);

代码是能正常执行,但是看结果还是Format8bppIndexed格式的。

难道要工具转换吗 或用代码转吗?

有做过的介绍下

mythzz的主页 mythzz | 初学一级 | 园豆:2
提问于:2009-02-23 20:26
< >
分享
最佳答案
2

很简单啊, 把8位bitmap画在24位bitmap上就可以了

Bitmap bitmap24 = new Bitmap(bmp.Width, bmp.Height,  System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            Graphics g = Graphics.FromImage(bitmap24);
            g.DrawImageUnscaled(bmp, 0, 0);

sawam | 菜鸟二级 |园豆:235 | 2009-02-24 09:45
其他回答(2)
0

楼上的答复真心有用,谢谢!

mingsmall | 园豆:202 (菜鸟二级) | 2018-05-04 12:44
0

楼上的可以用,但是CPU消耗有点高,如果连续调用

胡老湿 | 园豆:202 (菜鸟二级) | 2020-03-25 13:45
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册