Bitmap bmOld = new Bitmap(strOldFilePath);
int iwidth = bmOld.Width;
int iHeight = bmOld.Height; Bitmap bmNew = new Bitmap(iwidth, iHeight, PixelFormat.Format16bppRgb565);
Graphics g = Graphics.FromImage(bmNew);
g.DrawImage(bmOld, new Point(0,0));
g.Dispose();
//bmNew.Save(strNewFilePath, ImageFormat.Bmp); MessageBox.Show(bmOld.PixelFormat.ToString());
MessageBox.Show(bmNew.PixelFormat.ToString());网上有这种方法,但如果我把新的bitmap保存后,重新打开,再显示它的PixelFormat,则会变成Format32rgb了.
int iwidth = bmOld.Width;
int iHeight = bmOld.Height; Bitmap bmNew = new Bitmap(iwidth, iHeight, PixelFormat.Format16bppRgb565);
Graphics g = Graphics.FromImage(bmNew);
g.DrawImage(bmOld, new Point(0,0));
g.Dispose();
//bmNew.Save(strNewFilePath, ImageFormat.Bmp); MessageBox.Show(bmOld.PixelFormat.ToString());
MessageBox.Show(bmNew.PixelFormat.ToString());网上有这种方法,但如果我把新的bitmap保存后,重新打开,再显示它的PixelFormat,则会变成Format32rgb了.
--------------------
这样保存看看。
你看到的不一样,可能是因为你保存时扩展名还是bmp或者原来的.与后面的图片格式不一样.