System.Drawing.Image ii = System.Drawing.Image.FromStream(Request.Files[0].InputStream);
                    int width =100;
                    int height =120;
                    System.Drawing.Image iii = new System.Drawing.Bitmap(ii, new System.Drawing.Size(width, height));
                    System.Drawing.Imaging.ImageFormat ift = null;
                    if (filename.ToLower().Contains(".png"))
                        ift = System.Drawing.Imaging.ImageFormat.Png;
                    else if (filename.ToLower().Contains(".gif"))
                        ift = System.Drawing.Imaging.ImageFormat.Gif;
                    else if (filename.ToLower().Contains(".bmp"))
                        ift = System.Drawing.Imaging.ImageFormat.Bmp;
                    else
                        ift = System.Drawing.Imaging.ImageFormat.Jpeg;
                    iii.Save(AppDomain.CurrentDomain.BaseDirectory + path + filename, ift);

解决方案 »

  1.   

    private void TestDraw01()
    {
        Bitmap src = Bitmap.FromFile("yourfile.bmp");
        Bitmap dst = new Bitmap(src.Width / 2, src.Height / 2);
        using (Graphics g = Graphics.FromImage(dst))
        {
            g.DrawImage(src, new Rectangle(0, 0, dst.Width, dst.Height), new Rectangle(0, 0, src.Width, src.Height), GraphicsUnit.Pixel);
        }
        dst.Save("yourdest.bmp");
    }
      

  2.   

    dim Bp1 as new bitmap("c:\1.bmp")
    dim Bp2 as new bitmap(Bp1.Width/2,Bp1.Height/2)
    Using G as grpahics=graphics.fromimage(Bp2)
    G.DrawImage(Bp1,New Recteange(0,0,Bp2.Width,Bp2.Height),New Recteange(0,0,Bp1.Width,Bp1.Height),Pix)
    End Using
    dim Bp3 as new bitmap(Bp1.Width,Bp1.Height)
    Using G as grpahics=graphics.fromimage(Bp3)
    G.DrawImage(Bp2,New Recteange(0,0,Bp3.Width,Bp3.Height),New Recteange(0,0,Bp2.Width,Bp2.Height),Pix)
    end usingBp3.Save("C:\1_Convert.bmp")Bp1.Dispose
    Bp2.Dispose
    Bp3.Dispose
      

  3.   

    一句话即可~!
    Image thumbImg = Image.FromFile("filename.jpg").GetThumbnailImage(100, 120, null, new IntPtr());
      

  4.   

    最简单的方法 只有一句话Bitmap bitmap = new Bitmap(imageFile, new Size(width, height));第一个参数 imageFile -- 是指要输出的图片
    第二个参数 new Size -- 就是要输出的图片大小了 里面有两个参数 第一个参数是宽, 第二参数是高, 都是int型的