如何把Gif类型的图像转换成bmp

小流星子 2003-08-25 11:19:49
如题
...全文
116 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhehui 2003-08-25
  • 打赏
  • 举报
回复
可不可将BMP格式图片读到byte[]中后将其转变成jpeg格式的byte[]流。
panyee 2003-08-25
  • 打赏
  • 举报
回复
string originalFilename = "c:\\222.gif";
string stroutFile = "c:\\222.bmp";
System.Drawing.Image image = System.Drawing.Image.FromFile(originalFilename);
image.Save(stroutFile, System.Drawing.Imaging.ImageFormat.Bmp);
zhehui 2003-08-25
  • 打赏
  • 举报
回复

try
{
this.openFileDialog1.Filter = "BMP 图片 (*.bmp)|*.bmp|JPG 图片 (*.jpg)|*.jpg|GIF 图片 (*.gif)|*.gif|JPEG 图片(*.jpeg)|*.jpeg\" ";
openFileDialog1.Title = "请选择图片";


if(this.openFileDialog1.ShowDialog()==DialogResult.OK)
{
this.pictureBox1.Image=Image.FromFile(this.openFileDialog1.FileName);

}
try
{
MemoryStream mstream = new MemoryStream ();
pictureBox1.Image.Save (mstream, System.Drawing.Imaging.ImageFormat.Bmp);
theData = new Byte [mstream.Length ];
mstream.Position = 0;
mstream.Read (theData,0,Convert.ToInt32 (mstream.Length ));
mstream.Close();
}
catch
{
FileStream fs=new FileStream(this.openFileDialog1.FileName,FileMode.OpenOrCreate,FileAccess.Read);
theData=new byte[fs.Length];
fs.Read(theData,0,System.Convert.ToInt32(fs.Length));
fs.Close();
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
ms44 2003-08-25
  • 打赏
  • 举报
回复
已经有了类似的工具了?你可以DOWNLOAD啊?
不一定要自己写啊

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧