Image image1 = Image.FromFile("aaa.bmp");
image1.Save("aaa.jpg", ImageFormat.Jpeg);

解决方案 »

  1.   

    上面的方法很好(
    using System.Drawing.Imaging;)
      

  2.   

    我知道C#的API可以用image.Save…
    可能大大没看清楚喔…
    我是问说使用API的方法…
      

  3.   

    Bitmap bmp = new Bitmap(@"C:\aaa.bmp"); 
    bmp.Save(@"C:\aaa.jpg", ImageFormat.Jpeg);
    bmp.Dispose();
      

  4.   

    什么叫“不使用API”?
    不使用类库?.NET中不使用类库寸步难行~
      

  5.   

    我知道C#的API可以用image.Save…
    可能大大没看清楚喔…
    我是问说不使用API的方法…
    ----------------
    你说的API到底是windows api还是framework class lib?
    如果在c#中不用framework class lib,那你根本就寸步难行,还不如用c/c++
      

  6.   

    因為我要在windows mobile 2003裡開發程序..
    如果用ImageFormat.Jpeg會跳出錯誤...
    所有格式都會..只有ImageFormat.Bmp不會...
    那該如何阿??
      

  7.   

    晕...看来LZ连API是什么意思都搞不清楚...
      

  8.   

    因為我要在windows mobile 2003裡開發程序.. 
    如果用ImageFormat.Jpeg會跳出錯誤... 
    所有格式都會..只有ImageFormat.Bmp不會... 
    那該如何阿??--------------------------------------------
    呵呵。。学C#的不是每个人都学C++出生的.很多人只知道.net framework..
    楼主是不能调用.net framework自带的转换函数运行在mobile上吧..
    因为.net集成了bmp2jpeg类库,很少有人自己去开发已有的类库
    楼主一定要这样的话,可能还要自己写。。要不就到网上去下载C++开发的DLL,在.net里引用
      

  9.   

    你也可以直接反编译Bitmap.Save()然后哪里有问题改改就行了。。
      

  10.   

    using System.Drawing.Imaging;Image image1 = Image.FromFile("aaa.bmp"); 
    image1.Save("aaa.jpg", ImageFormat.Jpeg);
    這樣可以的呀,我用過。
      

  11.   

        public class imgConvert
        {
            public void BMPToJPG(string bmpFileName, string jpgFileName)
            {
                System.Drawing.Image img;
                img = ReturnPhoto(bmpFileName);            img.Save(jpgFileName, ImageFormat.Jpeg);
            }        public Image ReturnPhoto(string bmpFileName)
            {
                System.IO.FileStream stream;
                stream = File.OpenRead(bmpFileName);
                Bitmap bmp = new Bitmap(stream);
                System.Drawing.Image image = bmp;//得到原图
                //创建指定大小的图
                System.Drawing.Image newImage = image.GetThumbnailImage(bmp.Width, bmp.Height, null, new IntPtr());
                Graphics g = Graphics.FromImage(newImage);
                g.DrawImage(newImage, 0, 0, newImage.Width, newImage.Height); //将原图画到指定的图上
                g.Dispose();
                stream.Close();
                return newImage;
            }
        }