直接贴代码
——————————
有更好的方法一起讨论
float[][] transArray = {
new float[] { 1, 0, 0, 0, 0 },
new float[] { 0, 1, 0, 0, 0 },
new float[] { 0, 0, 1, 0, 0 },
new float[] { 0, 0, 0, 1f, 0 },
new float[] { 0, 0, 0, 0, 1 }
};
ColorMatrix mstrix = new ColorMatrix(transArray);
ImageAttributes attri = new ImageAttributes();
attri.SetColorMatrix(mstrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
Bitmap bmp = new Bitmap(@"E:/Jiho/ll.jpg");
e.Graphics.DrawImage(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height), 0, 0, bmp.Width, bmp.Height, GraphicsUnit.Pixel, attri);