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

How to C#: Color and Lightness Effects

Overview for Color and Lightness Effects


By using the XImage.Raster SDK, you can get and modify the color and lightness effects of image by assigning to processor. The related properties are as follows.


It may be useful to convert an image to 1bpp for facilitate cleanup image or image recognition. By setting the BinarizeThreshold property whose value range is 0 to 255, it will permanently modify the image to 1bpp grayscale image of the same dimensions. While, the BinarizeLceFactor property will control the image's contrast.


Negate colors in image, if you only want to negate grayscale values in the image, then pass value true to NegateImage method.


Simulate the scene of exposing a photographic film to light during the development process. The colors above threshold value will be negated.


The images' colors will be reduced to simulate a “poster” effect.


Convert the image to grayscale with a three-dimensional effect.

Steps to Posterize Image

Load an image with RasterImage object.

Create an image processor with ImageProcess object.

Call the PosterizeImage method 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.

Posterize Image

Sample Code (posterize image):

RasterImage img = new RasterImage(@"C:\input.tif");
ImageProcess process = new ImageProcess(img);
//simulate a poster effect, the number of color levels in each channel is set to 4. 
process.PosterizeImage(4, false);
//only posterize the second page of the input tif.
process.PosterizeImage(4, false, 1);