Bitmap clone = new Bitmap(bitmap.Width, bitmap.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
using (Graphics gr = Graphics.FromImage(clone))
{
gr.DrawImage(bitmap, new Rectangle(0, 0, clone.Width, clone.Height));
clone.SetResolution(xDpi, yDpi);
}
C#更改图的PixelFormat
于 2023-11-15 18:29:03 首次发布
本文介绍了如何使用C#中的Bitmap和Graphics类创建Bitmap对象的克隆,并设置新的分辨率。代码展示了如何将原图像绘制到新克隆图上并调整其像素格式为32位RGB。
2016

被折叠的 条评论
为什么被折叠?



