How to change color of images in C# Application

This C# Tutorial explains "How to edit any image or picture in C#?". This application will change Image colors by using System.Drawing.Imaging; Library. Apply general color tones to an image in this application. You can Download this application with its visual studio files.

Image Attributes in C#

In this application use the scroll bars to select a target color. Moving the image’s colors towards the target color may change the image’s overall brightness, so the program also includes a brightness scroll bar you can use to adjust the result. The code divides the brightness value by 128 to get a brightness scaling factor. The scroll bar can tackle values between 0 and 255 so this scale factor ranged between 0 and roughly 2. Next the program takes the red, green and blue components of the target color and divides them by 255 to get a value between 0 and 1. It then scales the results by the brightness scale factor. The program plugs the resulting color component scale factors into the ColorMatrix. Having created the ColorMatrix object, the code creates an ImageAttributes object and uses it to draw the image. This method is extremely fast so you can drag the scroll bars back and forth to change the result in real time. This gives a sense of how fast drawing with an ImageAttributes object is.

Source Code:

Check Its source Code


Check Output Video


Download this application in with visual studio files.

5 thoughts on “How to change color of images in C# Application”

Comments are closed.