How to C#: Imaging
Using Imaging SDK for C#.NET
Winforms Controls
Image Load
Image Access and Modify
Color and Contrast
Color and Contrast
Home ›› XImage.Raster ›› C# Raster: Modify Color and Contraste

How to C#: Modify Color and Contrast

Overview for How to Modify Color and Contrast


By using the XImage.Raster SDK, you can modify the image's color and contrast by assigning it to the processor. The same image displayed on different screen may be have a different perception about the image's intensities. The GammaImage method will adjust red, green and blue three channels with gamma parameter, or you can choose the GammaImageChannel method to adjust the three channels individually. If you are not sure what is the exactly value to use, call the AutoGammaImage method. Also, the method BtightnessContrastImage can modify the image's brightness and contrast individually or both two.

Related .net document control helps: create pdf using c#: ASP.NET Create PDF Document Control: create, convert PDF file from Word, Excel, Tiff file formats in C# ASP.NET
c# webforms document viewer: ASP.NET WebForms application document viewer control: view, annotate, redact, convert files online in ASP.NET
c# tiff document viewer: ASP.NET Tiff Document Viewer: view, annotate Tiff files in HTML using C# Control webforms pdf editor using c#: ASP.NET WebForms PDF Editor: create, view, edit, annotate, redact PDF file in ASP.NET WebForms application
c# iis document viewer: C# HTML5 Viewer: Deployment on IIS edit pdf page using c#: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C# open pdf password using c#: ASP.NET PDF Password Edit Control: online add, remove, update PDF file open password using C#

Steps to Modify Color and Contrast

Load an image with RasterImage object.

Create an image processor with ImageProcess object.

Call the method BrightnessContrastImage of ImageProcess object to complete the task flopping image.

Save the modified image to an image file on the disk.

In order to acheive the work, please refer to the following steps.

Install XImage.Raster in C# Project

Add necessary references to your C#.NET project. Right-click the project and select "Add Reference..." to locate and add the following DLLs as project references;




Use corresponding namespaces;

  using RasterEdge.XImage.Raster;

Note: When you get the error "Could not load file or assembly 'RasterEdge.Imaging.Basic' or any other assembly or one of its dependencies. An attempt to load a program with an incorrect format", please check your configure as follows:


       If you are using x64 libraries/dlls, Right click the project -> Properties -> Build -> Platform target: x64.


       If using x86, the platform target should be x86.

How to Modify Color and Contrast

Sample Code (modify image color and contrast):

RasterImage img = new RasterImage(@"F:\input.tif");
ImageProcess process = new ImageProcess(img);

//modify the brightness and contrast
process.BrightnessContrastImage(100F, 100F);
//If the image has multiple frames,>
//Only modify the brightness and contrast of the second page
process.BrightnessContrastImage(100F, 100F, 1);