tif转成jpg文件

来源:互联网 发布:古典音乐软件安卓 编辑:程序博客网 时间:2024/05/10 02:26
string address="E:\\1.tif";//tif文件物理路径  
System.IO.FileStream stream = System.IO.File.OpenRead(address);                        Bitmap bmp = new Bitmap(stream);                        System.Drawing.Image image = bmp;//得到原图                        //创建指定大小的图                         System.Drawing.Image newImage = image.GetThumbnailImage(424, 600, null, new IntPtr());                        Graphics g = Graphics.FromImage(newImage);                        g.DrawImage(newImage, 0, 0, newImage.Width, newImage.Height);                        //将原图画到指定的图上                        g.Dispose();                        stream.Close();                        newImage.Save(Server.MapPath(".") + "\\showFax.jpg", ImageFormat.Jpeg); //这里必须是物理路径