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



Related .net document control helps:
asp.net excel file viewer: ASP.NET Excel Document Viewer in C# Control: view office excel files online in ASP.NET web applications
asp.net pdf viewer control: ASP.NET PDF Viewer Control: view, navigate, zoom Adobe PDF document in C# ASP.NET
file redact asp.net: Redact document ASP.NET: add, delete, apply redaction on PDF files in web browser using C#.net
asp.net office document viewer: ASP.NET Office Word Document Viewer: view MS Office Word files online using C# in ASP.NET web applications
asp.net edit pdf image control: ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
asp.net edit pdf text control: ASP.NET PDF Text Edit Control: online edit PDF text content using C# ASP.NET
asp.net webforms file viewer: ASP.NET WebForms application document viewer control: view, annotate, redact, convert files online in ASP.NET


Overview



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.


Binarize


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


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


Solorize


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


Posterize


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


Emboss


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;


  RasterEdge.Imaging.Basic.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XImage.Raster.dll


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);
img.Save(@"C:\output.tif">);