为了账号安全,请及时绑定邮箱和手机立即绑定

Format8bppIndexed转 Format24bppRgb问题

Format8bppIndexed转 Format24bppRgb问题

九州编程 2018-11-07 15:09:35
bmp是Format8bppIndexed格式的(是带索引值的所有不能作相关的操作)通过 Rectangle rec = new Rectangle(0, 0, bmp.Width, bmp.Height);bmp= bmp.Clone(rec , PixelFormat.Format24bppRgb);代码是能正常执行,但是看结果还是Format8bppIndexed格式的。难道要工具转换吗 或用代码转吗?有做过的介绍下
查看完整描述

2 回答

?
隔江千里

TA贡献1906条经验 获得超10个赞

很简单啊, 把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);


查看完整回答
反对 回复 2018-11-12
?
aluckdog

TA贡献1847条经验 获得超7个赞

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

查看完整回答
反对 回复 2018-11-12
  • 2 回答
  • 0 关注
  • 1381 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信