C# 中把JPG格式的图片转换为BMP格式的 位深度必须是24位的 怎么弄啊 C# 中把JPG格式的图片转换为BMP格式的 位深度必须是24位的 怎么弄啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Image load 一下,再 save 就行了 Bitmap bmp=new Bitmap("filename");bmp.Save(".bmp",ImageFormat.bbp24);貌似是这样的you should try it by yourself. ImageFormat(好像是叫这个名字吧,总之是个枚举)注意引用 System.Drawing.Imaging;命名空间 上次回复 有错。。下面 这次正好打开VS试了一下你可以实例化的时候就像这样有点绕弯,但应该可以实现的献丑了代码如下: Bitmap source = new Bitmap("source.jpg"); Bitmap bmp = new Bitmap(source.Width, source.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb); Graphics.FromImage(bmp).DrawImage(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height)); bmp.Save("result.bmp", System.Drawing.Imaging.ImageFormat.Bmp); 帮你加个释放吧,免得你粗心忘了。 using (Bitmap source = new Bitmap("source.jpg")) { using (Bitmap bmp = new Bitmap(source.Width, source.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb)) { Graphics.FromImage(bmp).DrawImage(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height)); bmp.Save("result.bmp", System.Drawing.Imaging.ImageFormat.Bmp); } } 有出错了,再回复一下好了红色的部分是要改动的我真是太粗心了,见笑了 using (Bitmap source = new Bitmap("source.jpg")) { using (Bitmap bmp = new Bitmap(source.Width, source.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb)) { Graphics.FromImage(bmp).DrawImage(source, new Rectangle(0, 0, bmp.Width, bmp.Height)); bmp.Save("result.bmp", System.Drawing.Imaging.ImageFormat.Bmp); } } C#按钮问题 跪求C# 打包后 无法运行的原因 大家帮忙看看这段代码问题在哪,关于全文检索的 C# 对comboBox添加某些功能,想QQ登陆窗一样有个小叉叉,该什么实现 高手看过来,这个datagrid的问题怎么回事啊?郁闷中! 如何用程序或安装文件实现自动卸载已经安装的旧版本? 关于dataview 和datatable c#winform中label如何修改初始值 水晶报表数据源打印的问题 我要用System.Web.UI.WebControls.Calendar的日期多选 求C#中的一些知识的用法 什么时候使用泛型类?高手请进,诸位讨论下。
bmp.Save(".bmp",ImageFormat.bbp24);
貌似是这样的
you should try it by yourself.
下面 这次正好打开VS试了一下
你可以实例化的时候就像这样
有点绕弯,但应该可以实现的献丑了
代码如下:
Bitmap source = new Bitmap("source.jpg");
Bitmap bmp = new Bitmap(source.Width, source.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
Graphics.FromImage(bmp).DrawImage(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
bmp.Save("result.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
{
using (Bitmap bmp = new Bitmap(source.Width, source.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb))
{
Graphics.FromImage(bmp).DrawImage(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));
bmp.Save("result.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
}
}
再回复一下好了
红色的部分是要改动的我真是太粗心了,见笑了
using (Bitmap source = new Bitmap("source.jpg"))
{
using (Bitmap bmp = new Bitmap(source.Width, source.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb))
{
Graphics.FromImage(bmp).DrawImage(source, new Rectangle(0, 0, bmp.Width, bmp.Height));
bmp.Save("result.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
}
}