The task is to impose on the image of various filters. Those. add noise, ripples to the picture, make it black and white, change the brightness, etc. Surely for such operations there is a ready-made library, but the search only provides various tutorials on the implementation of such filters.
One of the guides wrote a change in brightness ... but why do what is already done and optimized
public static Image ChangeBrightness(Bitmap image, float brightness) { ImageAttributes imageAttributes = new ImageAttributes(); int width = image.Width; int height = image.Height; float[][] colorMatrixElements = { new float[] {brightness, 0, 0, 0, 0}, new float[] {0, brightness, 0, 0, 0}, new float[] {0, 0, brightness, 0, 0}, new float[] {0, 0, 0, 1, 0}, new float[] {0, 0, 0, 0, 1} }; ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements); imageAttributes.SetColorMatrix( colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); Graphics graphics = Graphics.FromImage(image); graphics.DrawImage(image, new Rectangle(0, 0, width, height), 0, 0, width, height, GraphicsUnit.Pixel, imageAttributes); return image; }