小弟的代码如下,运行无误,最终也调整过来了,但是最后保存的图片文件居然是一片漆黑!请各位赐教啊~
imageFile为源文件,newImageFile为大小调整后需要保存的文件
Code
My Code:
public static void Resized(string imageFile , string newImageFile)
{
Bitmap srcmap = new Bitmap(imageFile);
Bitmap destbit = new Bitmap(128 , 128);
Rectangle srcRec = new Rectangle(0 , 0 , srcmap.Width , srcmap.Width);
Rectangle destRec = new Rectangle(0 , 0 , 320 , 240);
Graphics g = Graphics.FromImage(destbit);
g.DrawImage(srcmap , destRec , srcRec , GraphicsUnit.Pixel);
destbit.Save(newImageFile , System.Drawing.Imaging.ImageFormat.Bmp);
}