我有一个位图正在执行着色转换。我有像素的新阵列,但我不知道那么如何将其保存到磁盘图像将位图像素阵列保存为新的位图
public static void TestProcessBitmap(string inputFile, string outputFile)
{
Bitmap bitmap = new Bitmap(inputFile);
Bitmap formatted = bitmap.Clone(new Rectangle(0, 0, bitmap.Width, bitmap.Height), System.Drawing.Imaging.PixelFormat.Format8bppIndexed);
byte[] pixels = BitmapToPixelArray(formatted);
pixels = Process8Bits(pixels, System.Windows.Media.Colors.Red);
Bitmap output = new Bitmap(pixels); //something like this
}
我怎样才能然后保存新的像素作为磁盘上的一个位图?
记得妥善处理你的位图。 http://stackoverflow.com/questions/5838608/net-and-bitmap-not-automatically-disposed-by-gc-when-there-is-no-memory-left – geedubb