static Image DullImage(Image img)
{
Bitmap newBitmap = new Bitmap(img.Width, img.Height, PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(newBitmap))
{
//g.DrawImage(image, 0.0f, 0.0f); //draw original image
ImageAttributes imageAttributes = new ImageAttributes();
int width = img.Width;
int height = img.Height;
float[][] colorMatrixElements = {
new float[] {1, 0, 0, 0, 0}, // red scaling factor of 1
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[] {.05f, .05f, .05f, 0, 1}}; // three translations of 0.2
ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements);
imageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
g.DrawImage(
img,
new Rectangle(0, 0, width, height), // destination rectangle
0, 0, // upper-left corner of source rectangle
width, // width of source rectangle
height, // height of source rectangle
GraphicsUnit.Pixel,
imageAttributes);
}
return newBitmap;
}
static Image CreateUpImage()