上传图片压缩之bitmap.save()参数无线

    public static String GetSmallIamge(string fileName, int width, int height, String path)
    {
        HttpContext context = HttpContext.Current;
        //把上传的文件做成一个Image对象
        Image image = Image.FromFile(fileName);

        //创建一个画布
        Bitmap smallImg = new Bitmap(width, height);
        Graphics g = Graphics.FromImage(smallImg);
        g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; //设置高质量,低速度呈现平滑程度
        g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; //清空画布并以透明背景色填充

        //将原图画到画布上
        g.DrawImage(image, new Rectangle(0, 0, width, height), new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);

        //释放资源
        image.Dispose();
        smallImg.Dispose();
        g.Dispose();

        //保存缩略图
        String newfileName = path + @"/samll-" + new Guid().ToString() + ".jpg";
        String savePath = context.Request.MapPath(newfileName);
        smallImg.Save(savePath);
        return newfileName;


    }


            ![图片说明](https://img-ask.csdn.net/upload/201705/02/1493720156_926367.jpg)

C#在windows平台,路径是反斜杠