Image image = new Bitmap(“InputColor.bmp”); ImageAttributes imageAttributes = new ImageAttributes(); int width = image.Width; int height = image.Height;
float[][] colorMatrixElements = { new float[] {2, 0, 0, 0, 0}, // red scaling factor of 2 new float[] {0, 1, 0, 0, 0}, // green scaling factor of 1 new float[] {0, 0, 1, 0, 0}, // blue scaling factor of 1 new float[] {0, 0, 0, 1, 0}, // alpha scaling factor of 1 new float[] {.2f, .2f, .2f, 0, 1}}; // three translations of 0.2
ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements);
Image image = new Bitmap(“ColorBars.bmp”); ImageAttributes imageAttributes = new ImageAttributes(); int width = image.Width; int height = image.Height;
float[][] colorMatrixElements = { new float[] {1, 0, 0, 0, 0}, new float[] {0, 1, 0, 0, 0}, new float[] {0.5f, 0, 1, 0, 0}, new float[] {0, 0, 0, 1, 0}, new float[] {0, 0, 0, 0, 1}};
ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements);