在上传图片的时候遇到一个比较棘手的问题,就是:由于有些数码相机拍摄的图片的分辨率过高,现在在网页上传此类图片的时候由于图片的分辨率过高导致上传的图片会出问题,现在想将上传的图片统一的由程序在上传的过程做自动的处理,将图片设置成800×600的像素,请问各位朋友有没有方面的代码。

解决方案 »

  1.   

    private Bitmap DrawNewMap (Bitmap oriMap, int width, int height )
            {
                Bitmap map = new Bitmap ( width, height );
                Graphics g = Graphics.FromImage ( map );
                g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;            g.DrawImage ( oriMap, new Rectangle ( 0, 0, width, height ), 0, 0,
                    oriMap.Width, oriMap.Height, GraphicsUnit.Pixel );            g.Dispose ();            return map;
            }