本文實例講述了C#數字圖像處理之圖像縮放的方法。分享給大家供大家參考。具體如下:
//定義圖像縮放函數private static Bitmap ZoomP(Bitmap a, float s, float v){ Bitmap bmp = new Bitmap((int)(a.Width * s), (int)(a.Height * v), System.Drawing.Imaging.PixelFormat.Format24bppRgb); Graphics g = Graphics.FromImage(bmp); g.Clear(Color .White ); g.ScaleTransform(s,v); g.DrawImage(a,0,0,a.Width ,a.Height ); a = bmp; return a;}
希望本文所述對大家的C#程序設計有所幫助。
新聞熱點
疑難解答