ASP.NET Image uploading with Resizing

前端 未结 14 1906
广开言路
广开言路 2020-11-30 01:27

I have an aspx page which will upload images to server harddisk from client pc

But now i need to change my program in such a way that it would allow me to resize the

14条回答
  •  无人及你
    2020-11-30 01:37

    To resize down a image and get smaller sizes just make the changes below

        bmpOut = new Bitmap(lnNewWidth, lnNewHeight, **System.Drawing.Imaging.PixelFormat.Format24bppRgb**);
    
         Graphics g = Graphics.FromImage(bmpOut);
    

    as you above a set the imagem to Format24bppRgb PixelFormat.

    and when you save the file, you set the ImageFormat also. Like this:

    bmpOut.Save(PathImage, System.Drawing.Imaging.ImageFormat.Jpeg);
    

提交回复
热议问题