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);

解决方案 »

  1.   

    可不可将BMP格式图片读到byte[]中后将其转变成jpeg格式的byte[]流。
      

  2.   

    已经有了类似的工具了?你可以DOWNLOAD啊?
    不一定要自己写啊
      

  3.   


    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);
    }