C# Imaging Library
How to C#: Special Effects
Overview for Special Effects
How to apply image special effects using C#?
By using the XImage.Raster SDK, you can get and modify special effects of image by assigning to processor. The related properties are as follows
- AddNoise Add specific type(NosiType enumeration) noise to the image.
- Buttonize Lighten or darken the edge of the image to simulate a 3D button effect.
- CandyEdge Detect a wide range of edges in the image.
- CharcoalSkectch Stimulate a charcoal sketch.
- Clamp If the pixel value is below zero, then set it to zero, if the pixel value above quantum range(e.g. 65535 or 255), then set it to quantum range.
- Crop Get the specific sub-region of the original image
- Distort Distort the image with a variety of distort methods, such as Perspective ,Bilinear, barrel and so on.
- Compare Compare two images.
- Decipher Decipher the image with specified pass phrase.
- Edge Highlight the image edge.
- Enhance A digital filter will be applied to the noisy image to improve it’s quality.
- Erase Set the image to current background color, the background color can be set by:ImageProcess.BackgroundColor = Color.Red.
- Encipher Encipher the image with specified pass phrase.
- Effect3D Stereo image. you should have two images: left.png and right.png.
Firstly, call SepareteImageChannel(ChannelType.Red) to get a grayscale image which extract form the left.png image's red channel. Then call SepareteImageChannel(ChannelType.Blue) to get a grayscale image which extract form the right.png image's blue channel. Next, call this method. At last, View the result with red-blue glasses.
- Frame Surround the image with a three-dimensional border.
- HoughLine Use with CannyEdgeImage method to identify lines in the image.
- Implode Implode image pixel with the specified percentage.
- Kuwahara An edge preserving filter will be applied to the image to reduce the noise.
- LinearStretch Level the pixel between the black point and white point.
- Magnify Double the image size.
- Mignify Half the image size.
- Normolize Get the darkest pixel value and map 2% of it to all the pixels, get the brightest pixel value and map 1% of it to all the pixels.
- OilPaint A filter will be applied to the image to simulate a oil painting effect.
- PencilSketch Simulates a pencil sketch
- ReduceNoise Use the peak elimination filter to reduce the image noise.
- Swirl Rotate image pixel with the specified angle.
- Texture Repeatedly tiles the image(texture) on the original image background.
- Wave Shift the image pixel along a sin wave to simulate a wave effect.
List of load options
- Load an image with RasterImage object.
- Create an image processor with ImageProcess object.
- Call the responding method of ImageProcess object to complete the task flopping image.
- Save the modified image to an image file on the disk.
Modify Image Special Effects
Sample Code (Image Effect3D):
RasterImage leftImage = new RasterImage(@"F:\Source1.png");
RasterImage rightImage = new RasterImage(@"F:\Source2.png");
ImageProcess processLeft = new ImageProcess(leftImage);
ImageProcess processRight = new ImageProcess(rightImage);
//get red channel of the image and returned it as a grayscale image
processLeft.GetImageChannel(ChannelType.RedChannel);
//get blue channel of the image and returned it as a grayscale image
processRight.GetImageChannel(ChannelType.BlueChannel);
processLeft.Effect3D(rightImage);
leftImage.Save(@"F:\Output.png");